[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201009104654.GA29783@willie-the-truck>
Date: Fri, 9 Oct 2020 11:46:55 +0100
From: Will Deacon <will@...nel.org>
To: Mark Rutland <mark.rutland@....com>
Cc: Qian Cai <cai@...hat.com>, linux-arm-kernel@...ts.infradead.org,
Catalin Marinas <catalin.marinas@....com>,
James Morse <james.morse@....com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Linux Next Mailing List <linux-next@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv2] arm64: initialize per-cpu offsets earlier
On Fri, Oct 09, 2020 at 11:24:38AM +0100, Mark Rutland wrote:
> On Fri, Oct 09, 2020 at 10:43:18AM +0100, Mark Rutland wrote:
> > Hi Qian,
> >
> > On Fri, Oct 09, 2020 at 09:51:15AM +0100, Will Deacon wrote:
> > > On Thu, Oct 08, 2020 at 09:18:24PM -0400, Qian Cai wrote:
> > > > On Mon, 2020-10-05 at 17:43 +0100, Mark Rutland wrote:
> > > > > The current initialization of the per-cpu offset register is difficult
> > > > > to follow and this initialization is not always early enough for
> > > > > upcoming instrumentation with KCSAN, where the instrumentation callbacks
> > > > > use the per-cpu offset.
> > > > >
> > > > > To make it possible to support KCSAN, and to simplify reasoning about
> > > > > early bringup code, let's initialize the per-cpu offset earlier, before
> > > > > we run any C code that may consume it. To do so, this patch adds a new
> > > > > init_this_cpu_offset() helper that's called before the usual
> > > > > primary/secondary start functions. For consistency, this is also used to
> > > > > re-initialize the per-cpu offset after the runtime per-cpu areas have
> > > > > been allocated (which can change CPU0's offset).
> > > > >
> > > > > So that init_this_cpu_offset() isn't subject to any instrumentation that
> > > > > might consume the per-cpu offset, it is marked with noinstr, preventing
> > > > > instrumentation.
> > > > >
> > > > > Signed-off-by: Mark Rutland <mark.rutland@....com>
> > > > > Cc: Catalin Marinas <catalin.marinas@....com>
> > > > > Cc: James Morse <james.morse@....com>
> > > > > Cc: Will Deacon <will@...nel.org>
> > > >
> > > > Reverting this commit on the top of today's linux-next fixed an issue that
> > > > Thunder X2 is unable to boot:
> > > >
> > > > .config: https://gitlab.com/cailca/linux-mm/-/blob/master/arm64.config
> >
> > Sorry about this. :/
> >
> > Will, to save you reading all the below, I think the right thing to do
> > for now is to revert this.
>
>
> > Looking at the assembly, task_cpu() gets instrumented (which puts this
> > patch on dodgy ground generally and I think warrants the revert), but as
> > it's instrumented with KASAN_INLINE that doesn't immediately explain the
> > issue since the shadow should be up and so we shouldn't call the report
> > function. I'll dig into this some more.
>
> Ok; that's my fault due to trying to do this before kasan_early_init.
>
> I see what's going on now. If you're happy to take a fixup instead of a
> revert, patch below. Otherwise I'll a complete patch atop of the revert
> after rc1.
For now, I've reverted the patch on for-next/core and redone the tag.
Will
Powered by blists - more mailing lists