From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E0F7CD4853 for ; Wed, 4 Sep 2024 17:17:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E26E46B00B4; Wed, 4 Sep 2024 13:17:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD77A6B00BD; Wed, 4 Sep 2024 13:17:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C51276B00D1; Wed, 4 Sep 2024 13:17:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A6AB06B00B4 for ; Wed, 4 Sep 2024 13:17:35 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E926041427 for ; Wed, 4 Sep 2024 17:17:34 +0000 (UTC) X-FDA: 82527712428.23.76F7A4B Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by imf11.hostedemail.com (Postfix) with ESMTP id AEF534001E for ; Wed, 4 Sep 2024 17:17:32 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725470228; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tvg+Vle+MJQ/mfolO9G0sa8zx61JLnXwXlAud0k5eNc=; b=E5ZNaka2aLWwocxHpIroVuVc813LTp17yoiRMqnprZUO0tPGIaaJp6222kz51HGMc1BPjm 9AU1R0CRLe7pqJ70ptlGMyXFUt+aeHg++fcXSXTdCHeVT7xGj7FtRmtXi5YkXGDHq40ZLR HsCy7919w1SCHi591lqwA+SYfCnMpzs= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of christophe.leroy@csgroup.eu designates 93.17.235.10 as permitted sender) smtp.mailfrom=christophe.leroy@csgroup.eu; dmarc=pass (policy=quarantine) header.from=csgroup.eu ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725470228; a=rsa-sha256; cv=none; b=trMRBgXvVCxMfk9gIUWMPL6OQMfxMEvd9lde/LpeQ2kpih+pfm9dWrlFWk6qaHD72Evo6s UuQwLCaoHQq6szwAOQwpJl4aRNZz37HsSibZyO7Aete5osW3Qrd/MX8pvPigy6qT74QS7F rxxbHrGdieEgcrciyPPdbn0uheKKMCo= Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4WzThB6wRTz9sST; Wed, 4 Sep 2024 19:17:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23q8UjPNxB-l; Wed, 4 Sep 2024 19:17:30 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4WzThB5g1Yz9sSS; Wed, 4 Sep 2024 19:17:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AC51E8B77A; Wed, 4 Sep 2024 19:17:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id paQV1BysDOD5; Wed, 4 Sep 2024 19:17:30 +0200 (CEST) Received: from [192.168.234.246] (unknown [192.168.234.246]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C71548B778; Wed, 4 Sep 2024 19:17:29 +0200 (CEST) Message-ID: Date: Wed, 4 Sep 2024 19:17:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/9] vdso: Split linux/minmax.h To: Vincenzo Frascino , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org Cc: Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , Theodore Ts'o , Arnd Bergmann , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> <20240903151437.1002990-6-vincenzo.frascino@arm.com> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: <20240903151437.1002990-6-vincenzo.frascino@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Stat-Signature: 86gjrmsqtjz69b9fhgbuxwrp66nt7dbj X-Rspamd-Queue-Id: AEF534001E X-Rspamd-Server: rspam11 X-HE-Tag: 1725470252-95370 X-HE-Meta: U2FsdGVkX19VmlV4xoAvc01ezog5R8QKJlDvXYUDLK4qbdOQp+WIRDF9oG+eBusTmdv3GxYu+2lTuL8cjxovxko9j6rhtLe1HssAftJvnUg4ktwqQt1v1ar2suCtplQbR9/2bNmVc1u01RPvQyPZfcJgHS7+PAkPzep12YvMUZFdDURlBI9XqfggEKoq0kc12gZ9Kp53nyEqJtPGfp9MK0lySHtFGYn7lm/aQeiE0GG6i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GJ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Le 03/09/2024 à 17:14, Vincenzo Frascino a écrit : > The VDSO implementation includes headers from outside of the > vdso/ namespace. > > Split linux/minmax.h to make sure that the generic library > uses only the allowed namespace. It is probably easier to just don't use min_t() in VDSO. Can be open coded without impeeding readability. > > Cc: Andy Lutomirski > Cc: Thomas Gleixner > Cc: Jason A. Donenfeld > Signed-off-by: Vincenzo Frascino > --- > include/linux/minmax.h | 28 +--------------------------- > include/vdso/minmax.h | 38 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 39 insertions(+), 27 deletions(-) > create mode 100644 include/vdso/minmax.h > > diff --git a/include/linux/minmax.h b/include/linux/minmax.h > index 98008dd92153..846e3fa65c96 100644 > --- a/include/linux/minmax.h > +++ b/include/linux/minmax.h > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > > /* > * min()/max()/clamp() macros must accomplish three things: > @@ -84,17 +85,6 @@ > #define __types_ok3(x,y,z,ux,uy,uz) \ > (__sign_use(x,ux) & __sign_use(y,uy) & __sign_use(z,uz)) > > -#define __cmp_op_min < > -#define __cmp_op_max > > - > -#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y)) > - > -#define __cmp_once_unique(op, type, x, y, ux, uy) \ > - ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) > - > -#define __cmp_once(op, type, x, y) \ > - __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) > - > #define __careful_cmp_once(op, x, y, ux, uy) ({ \ > __auto_type ux = (x); __auto_type uy = (y); \ > BUILD_BUG_ON_MSG(!__types_ok(x,y,ux,uy), \ > @@ -204,22 +194,6 @@ > * Or not use min/max/clamp at all, of course. > */ > > -/** > - * min_t - return minimum of two values, using the specified type > - * @type: data type to use > - * @x: first value > - * @y: second value > - */ > -#define min_t(type, x, y) __cmp_once(min, type, x, y) > - > -/** > - * max_t - return maximum of two values, using the specified type > - * @type: data type to use > - * @x: first value > - * @y: second value > - */ > -#define max_t(type, x, y) __cmp_once(max, type, x, y) > - > /* > * Do not check the array parameter using __must_be_array(). > * In the following legit use-case where the "array" passed is a simple pointer, > diff --git a/include/vdso/minmax.h b/include/vdso/minmax.h > new file mode 100644 > index 000000000000..26724f34c513 > --- /dev/null > +++ b/include/vdso/minmax.h > @@ -0,0 +1,38 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef __VDSO_MINMAX_H > +#define __VDSO_MINMAX_H > + > +#ifndef __ASSEMBLY__ > + > +#include > + > +#define __cmp_op_min < > +#define __cmp_op_max > > + > +#define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y)) > + > +#define __cmp_once_unique(op, type, x, y, ux, uy) \ > + ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) > + > +#define __cmp_once(op, type, x, y) \ > + __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) > + > +/** > + * min_t - return minimum of two values, using the specified type > + * @type: data type to use > + * @x: first value > + * @y: second value > + */ > +#define min_t(type, x, y) __cmp_once(min, type, x, y) > + > +/** > + * max_t - return maximum of two values, using the specified type > + * @type: data type to use > + * @x: first value > + * @y: second value > + */ > +#define max_t(type, x, y) __cmp_once(max, type, x, y) > + > +#endif /* !__ASSEMBLY__ */ > + > +#endif /* __VDSO_MINMAX_H */