From: Atish Patra <Atish.Patra@wdc.com>
To: "paul.walmsley@sifive.com" <paul.walmsley@sifive.com>
Cc: "aou@eecs.berkeley.edu" <aou@eecs.berkeley.edu>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"palmer@sifive.com" <palmer@sifive.com>,
"johan@kernel.org" <johan@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"rfontana@redhat.com" <rfontana@redhat.com>,
"anup@brainfault.org" <anup@brainfault.org>,
"linux-riscv@lists.infradead.org"
<linux-riscv@lists.infradead.org>,
"info@metux.net" <info@metux.net>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"allison@lohutok.net" <allison@lohutok.net>
Subject: Re: [PATCH v2 2/2] RISC-V: Consolidate isa correctness check
Date: Mon, 4 Nov 2019 23:06:53 +0000 [thread overview]
Message-ID: <f7585738ea71f0dbe46011e3e718e7c3ba065eea.camel@wdc.com> (raw)
In-Reply-To: <alpine.DEB.2.21.9999.1910181121270.21875@viisi.sifive.com>
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@wdc.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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2019-11-04 23:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 22:00 [PATCH v2 0/2] Cleanup isa string access and print Atish Patra
2019-10-09 22:00 ` [PATCH v2 1/2] RISC-V: Remove unsupported isa string info print Atish Patra
2019-10-18 8:19 ` Paul Walmsley
2019-10-09 22:00 ` [PATCH v2 2/2] RISC-V: Consolidate isa correctness check Atish Patra
2019-10-18 8:43 ` Paul Walmsley
2019-10-18 17:53 ` Atish Patra
2019-10-18 18:25 ` Paul Walmsley
2019-11-04 23:06 ` Atish Patra [this message]
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=f7585738ea71f0dbe46011e3e718e7c3ba065eea.camel@wdc.com \
--to=atish.patra@wdc.com \
--cc=allison@lohutok.net \
--cc=anup@brainfault.org \
--cc=aou@eecs.berkeley.edu \
--cc=gregkh@linuxfoundation.org \
--cc=info@metux.net \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=paul.walmsley@sifive.com \
--cc=rfontana@redhat.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).