From: Thomas Gleixner <tglx@linutronix.de>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Tejun Heo <tj@kernel.org>,
cl@linux.com, mingo@redhat.com, "H. Peter Anvin" <hpa@zytor.com>,
bp@suse.de, Andy Lutomirski <luto@kernel.org>,
kirill.shutemov@linux.intel.com, thgarnie@google.com,
Josh Poimboeuf <jpoimboe@redhat.com>,
minipli@googlemail.com, me@kylehuey.com, namit@vmware.com,
tklauser@distanz.ch, thomas.lendacky@amd.com,
LKML <linux-kernel@vger.kernel.org>,
x86@kernel.org
Subject: Re: correct section for cpu_tss_rw?
Date: Wed, 3 Jan 2018 20:27:32 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1801032025310.1957@nanos> (raw)
In-Reply-To: <CAKwvOdkw2CdjOWQwEUSQOq4ScBWxeYuRbHtbTcXsdCrqwXigUA@mail.gmail.com>
On Tue, 2 Jan 2018, Nick Desaulniers wrote:
> (emailing the folks listed from running `./scripts/get_maintainer.pl
> -f` on arch/x86/kernel/process.c, arch/x86/include/asm/processor.h,
> and include/linux/percpu-defs.h)
>
> Clang emits the following warning:
>
> arch/x86/kernel/process.c:50:11: warning: section does not match
> previous declaration [-Wsection]
> __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss_rw) = {
> ^
> ./include/linux/percpu-defs.h:144:2: note: expanded from macro
> 'DEFINE_PER_CPU_SHARED_ALIGNED'
> DEFINE_PER_CPU_SECTION(type, name, PER_CPU_SHARED_ALIGNED_SECTION) \
> ^
> ./include/linux/percpu-defs.h:104:2: note: expanded from macro
> 'DEFINE_PER_CPU_SECTION'
> __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \
> ^
> ./include/linux/percpu-defs.h:49:26: note: expanded from macro '__PCPU_ATTRS'
> __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
> ^
> ./arch/x86/include/asm/processor.h:365:1: note: previous attribute is here
> DECLARE_PER_CPU_PAGE_ALIGNED(struct tss_struct, cpu_tss_rw);
> ^
> ./include/linux/percpu-defs.h:159:2: note: expanded from macro
> 'DECLARE_PER_CPU_PAGE_ALIGNED'
> DECLARE_PER_CPU_SECTION(type, name, "..page_aligned") \
> ^
> ./include/linux/percpu-defs.h:101:9: note: expanded from macro
> 'DECLARE_PER_CPU_SECTION'
> extern __PCPU_ATTRS(sec) __typeof__(type) name
> ^
> ./include/linux/percpu-defs.h:49:26: note: expanded from macro '__PCPU_ATTRS'
> __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \
> ^
>
> it seems that from commit c482feefe1a ("x86/entry/64: Make
> cpu_entry_area.tss read-only") that cpu_tss_rw is declared but then
> defined in two different sections. (Though, it looks like this issue
> predates that commit).
>
> It seems that cpu_tss_rw is defined as SHARED_ALIGNED, but then
> declared as PAGE_ALIGNED. Should be an easy fix (that I'm happy to
> author), but what section *should* cpu_tss_rw be in (SHARED_ALIGNED or
> PAGE_ALIGNED)? That affects whether I fix the declaration or
> definition (and thus the .h or the .c file).
>
> >From the comment in arch/x86/kernel/process.c#50:
> 43 /*
> 44 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
> 45 * no more per-task TSS's. The TSS size is kept cacheline-aligned
> 46 * so they are allowed to end up in the .data..cacheline_aligned
> 47 * section. Since TSS's are completely CPU-local, we want them
> 48 * on exact cacheline boundaries, to eliminate cacheline
> ping-pong.
> 49 */
> 50 __visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, cpu_tss_rw) = {
>
> I suspect that cache-line alignment is stricter than page alignment,
> so the declaration should be fixed, but I was not sure and wanted to
> check?
It must be page aligned.
Thanks,
tglx
next prev parent reply other threads:[~2018-01-03 19:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-02 18:51 Nick Desaulniers
2018-01-03 19:27 ` Thomas Gleixner [this message]
2018-01-03 20:39 ` [PATCH] x86/process: define cpu_tss_rw in same section as declaration Nick Desaulniers
2018-01-03 22:25 ` [tip:x86/pti] x86/process: Define " tip-bot for Nick Desaulniers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1801032025310.1957@nanos \
--to=tglx@linutronix.de \
--cc=bp@suse.de \
--cc=cl@linux.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=me@kylehuey.com \
--cc=mingo@redhat.com \
--cc=minipli@googlemail.com \
--cc=namit@vmware.com \
--cc=ndesaulniers@google.com \
--cc=thgarnie@google.com \
--cc=thomas.lendacky@amd.com \
--cc=tj@kernel.org \
--cc=tklauser@distanz.ch \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®