From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D39D1B85D5; Tue, 24 Sep 2024 14:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727187066; cv=none; b=KoT7WDvCznj8gfZQX2ubWTGCSKUcyZdWsIJcHK6un2SvhGl5FBA3aDqh7XhqPwjhjbHDT3Mgr1Xgbbx3gWHHIbXeeSCra5UDOEU+a9cEM1oz575BtzoMVObjAOkJhTJFxe5UCm6LG51krxjzsIYf0RyNC5dK33y5hgEb+NBArbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727187066; c=relaxed/simple; bh=i5rmoElxEjHeqYioWgetey9pZgrZWLg5GZgY/JXJrpU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Gm/xsNR28KXEJRJ7a9KlgmtQo6D5DqgD+SqI/O2+Ynw05kcFh5tWsHAZqXTwbFOpfc7RiAcIap8TcH1FCsoZU2bRBtRWKAerNxPaqOh3/7jAuAUJFLMuljp+z5kWiEJI4hHUjf1F3Knuy2oUrPuwDEQpp1REXLYbDdZnPmF8xoI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D09F8DA7; Tue, 24 Sep 2024 07:11:31 -0700 (PDT) Received: from [10.1.196.72] (e119884-lin.cambridge.arm.com [10.1.196.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 149F13F528; Tue, 24 Sep 2024 07:10:59 -0700 (PDT) Message-ID: <645e5f3f-debf-4f68-ad75-4fb749b07a5b@arm.com> Date: Tue, 24 Sep 2024 15:10:58 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 4/8] vdso: Introduce vdso/page.h To: Arnd Bergmann , linux-kernel@vger.kernel.org, Linux-Arch , linux-mm@kvack.org Cc: Andy Lutomirski , Thomas Gleixner , "Jason A . Donenfeld" , Christophe Leroy , Michael Ellerman , Nicholas Piggin , Naveen N Rao , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Theodore Ts'o , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers References: <20240923141943.133551-1-vincenzo.frascino@arm.com> <20240923141943.133551-5-vincenzo.frascino@arm.com> Content-Language: en-US From: Vincenzo Frascino In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 23/09/2024 17:54, Arnd Bergmann wrote: > On Mon, Sep 23, 2024, at 14:19, Vincenzo Frascino wrote: >> The VDSO implementation includes headers from outside of the >> vdso/ namespace. >> >> Introduce vdso/page.h to make sure that the generic library >> uses only the allowed namespace. >> >> Cc: Andy Lutomirski >> Cc: Thomas Gleixner >> Cc: Jason A. Donenfeld >> Signed-off-by: Vincenzo Frascino > > Thanks for the new version. This looks all good, just some > very minor ideas for how to possibly improve the new version: > Thanks Arnd. >> +/* PAGE_SHIFT determines the page size */ >> +#define PAGE_SHIFT CONFIG_PAGE_SHIFT >> + >> +#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) >> + >> +#if defined(CONFIG_PHYS_ADDR_T_64BIT) && !defined(CONFIG_X86_64) >> +#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) >> +#else >> +#define PAGE_MASK (~(PAGE_SIZE-1)) >> +#endif > > I would open-code the CONFIG_PAGE_SHIFT in PAGE_SIZE > and PAGE_MASK, just to avoid the extra indirection in the > preprocessor. This mainly has the benefit of slightly > shorter compiler warnings when all the macros get > traced back but can also slightly improve compile speed > in case this is used in deeply nested macros. > I will fix it in the next iteration. > Without a comment, the special case for CONFIG_X86_64 > not very clear, and probably not needed. If you are > worried about introducing an architecture specific > regression, I would suggest instead explaining the > possible issue in the patch description but using the > more generic and simpler #ifdef check. > If I do not add the #ifdef, it does not build. But you are right, I should have put a comment in the commit message. Regression below: drivers/gpu/drm/i915/gt/intel_gt_print.h:29:36: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘u32’ {aka ‘unsigned int’} [-Werror=format=] 29 | drm_dbg(&(_gt)->i915->drm, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__) | ^~~~~~~~ include/drm/drm_print.h:424:39: note: in definition of macro ‘drm_dev_dbg’ 424 | __drm_dev_dbg(NULL, dev, cat, fmt, ##__VA_ARGS__) | ^~~ include/drm/drm_print.h:524:33: note: in expansion of macro ‘drm_dbg_driver’ 524 | #define drm_dbg(drm, fmt, ...) drm_dbg_driver(drm, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~~~ linux/drivers/gpu/drm/i915/gt/intel_gt_print.h:29:9: note: in expansion of macro ‘drm_dbg’ 29 | drm_dbg(&(_gt)->i915->drm, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__) | ^~~~~~~ drivers/gpu/drm/i915/gt/intel_gt.c:310:25: note: in expansion of macro ‘gt_dbg’ 310 | gt_dbg(gt, "Unexpected fault\n" | ^~~~~~ I am open to alternative suggestions. > Arnd -- Regards, Vincenzo