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 7F1811A2C39; Fri, 6 Sep 2024 11:26:52 +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=1725622014; cv=none; b=ed0i+kqHNz+DsWGkIFJh1tvaHMN0N3lSAEyWfYQkui3xrvi0Aiw6rTwIWBbqwTFahdsYDT4A2u205WR6eF5IgNw6SfeeiXGgo5g6Zdkzd19ldWvv/xYPUCFUFjrJVwioHhbf21Di3afHyhftS2VWXFNo/mmBJTrKrCtw2BXwxBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725622014; c=relaxed/simple; bh=6USmevgAKj0TyTAIi4ocDh6np/lUc3s/1UeLS1HvASo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uqYx6/de7uYRDd7pKGrTi1BsbZRshoWspKAekicuqIJEt37yffk8DpsziLVquV/+ixmrZWE1ee06Ah8+tJ863R9osx+eJtZllHI9tw4VxrE/kTAJnPkx6bARUkMmYD86r5KxNawPko7jAdSH+ceXvGB4+KF6dOFpy9C99zyJSx4= 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 A7FD7FEC; Fri, 6 Sep 2024 04:27:18 -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 497F23F73B; Fri, 6 Sep 2024 04:26:49 -0700 (PDT) Message-ID: Date: Fri, 6 Sep 2024 12:26:47 +0100 Precedence: bulk X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/9] x86: vdso: Introduce asm/vdso/page.h To: Christophe Leroy , Arnd Bergmann , linux-kernel@vger.kernel.org, Linux-Arch , 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 , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers References: <20240903151437.1002990-1-vincenzo.frascino@arm.com> <20240903151437.1002990-4-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 04/09/2024 16:05, Christophe Leroy wrote: > > > Le 04/09/2024 à 16:52, Arnd Bergmann a écrit : >> On Tue, Sep 3, 2024, at 15:14, Vincenzo Frascino wrote: >> ... >>> + >>> +#ifndef __ASSEMBLY__ >>> + >>> +#include >>> + >>> +#define VDSO_PAGE_MASK    PAGE_MASK >>> +#define VDSO_PAGE_SIZE    PAGE_SIZE >>> + >>> +#endif /* !__ASSEMBLY__ */ >>> + >>> +#endif /* __ASM_VDSO_PAGE_H */ >> >> I don't get this one: the x86 asm/page_types.h still includes other >> headers outside of the vdso namespace, but you seem to only need these >> two definitions that are the same across everything. >> >> Why not put PAGE_MASK and PAGE_SIZE into a global vdso/page.h >> header? I did spend a lot of time a few months ago ensuring that >> we can have a single definition for all architectures based on >> CONFIG_PAGE_SHIFT, so all the extra copies should just go away. >> > > Just wondering, after looking at x86, powerpc and arm64, is there any difference > between: > > X86,ARM64: > #define PAGE_SIZE        (_AC(1,UL) << PAGE_SHIFT) > #define PAGE_MASK        (~(PAGE_SIZE-1)) > > POWERPC: > #define PAGE_SIZE        (ASM_CONST(1) << PAGE_SHIFT) > /* >  * Subtle: (1 << PAGE_SHIFT) is an int, not an unsigned long. So if we >  * assign PAGE_MASK to a larger type it gets extended the way we want >  * (i.e. with 1s in the high bits) >  */ > #define PAGE_MASK      (~((1 << PAGE_SHIFT) - 1)) > > > Which one should be taken in vdso/page.h ? > I am not sure either on this point. That's the main reason why I proposed an indirection for the definitions. > Christophe -- Regards, Vincenzo