[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f7585738ea71f0dbe46011e3e718e7c3ba065eea.camel@wdc.com>
Date: Mon, 4 Nov 2019 23:06:53 +0000
From: Atish Patra <Atish.Patra@....com>
To: "paul.walmsley@...ive.com" <paul.walmsley@...ive.com>
CC: "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"info@...ux.net" <info@...ux.net>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"rfontana@...hat.com" <rfontana@...hat.com>,
"johan@...nel.org" <johan@...nel.org>,
"anup@...infault.org" <anup@...infault.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"palmer@...ive.com" <palmer@...ive.com>,
"aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
"allison@...utok.net" <allison@...utok.net>
Subject: Re: [PATCH v2 2/2] RISC-V: Consolidate isa correctness check
On Fri, 2019-10-18 at 11:25 -0700, Paul Walmsley wrote:
> On Fri, 18 Oct 2019, Atish Patra wrote:
>
> > On Fri, 2019-10-18 at 01:43 -0700, Paul Walmsley wrote:
> > > On Wed, 9 Oct 2019, Atish Patra wrote:
> > >
> > > > Currently, isa string is read and checked for correctness at
> > > > multiple places.
> > > >
> > > > Consolidate them into one function and use it only during
> > > > early
> > > > bootup. In case of a incorrect isa string, the cpu shouldn't
> > > > boot at
> > > > all.
> > > >
> > > > Signed-off-by: Atish Patra <atish.patra@....com>
> > >
> > > Looks like riscv_read_check_isa() is called twice for each
> > > hart. Is
> > > there any way to call it only once per hart?
> > >
> >
> > I had to add the check in riscv_fill_hwcap() because that function
> > is
> > iterating over all cpu nodes to set the hwcap. Thus, some of the
> > harts
> > that are not available due to incorrect isa string can affect
> > hwcap.
> >
> > We can check cpu_possible_mask to figure out the harts with invalid
> > isa
> > strings but that will perform poorly as RISC-V have more harts in
> > future.
>
> How about just calling riscv_read_check_isa() once for all harts and
> leaving riscv_fill_hwcap() the way it was?
> You'll probably need to hoist
> the earlier call out of setup_smp(), so it still is called when
> !CONFIG_SMP.
Currently, it doesn't let boot any cpu with incorrect isa string for
smp usecase. We still need to preserve that usecase. I think
setup_smp() use is unavoidable.
If the boot cpu has incorrect isa info for !CONFIG_SMP, I guess we
should halt the boot with BUG_ON. This is a separate
riscv_read_check_isa call with boot hart device node.
This is what we can do:
Maintain a global cpumask of harts with invalid isa strings which would
be set during early bootup (before setup_smp). This cpumask will be
used in setup_smp() and riscv_fill_hwcap() to avoid using harts with
invalid isa. This will make sure that there is only single invocaiton
of riscv_read_check_isa(). In most cases, this cpumask will be empty
and penalty of cpumask check won't matter.
Is that what you had in mind or any other approach to address all 3
usecases ?
>
> - Paul
--
Regards,
Atish
Powered by blists - more mailing lists