[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXHA-GiAj2u4vRbEsnJ6O=cxiNOEgPHWHP+71dB-sp9Nww@mail.gmail.com>
Date: Tue, 7 Sep 2021 18:05:47 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: Keith Packard <keithp@...thp.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Abbott Liu <liuwenliang@...wei.com>,
Alexander Sverdlin <alexander.sverdlin@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Anshuman Khandual <anshuman.khandual@....com>,
Arnd Bergmann <arnd@...db.de>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Florian Fainelli <f.fainelli@...il.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Hartley Sweeten <hsweeten@...ionengravers.com>,
Jens Axboe <axboe@...nel.dk>, Jian Cai <jiancai@...gle.com>,
Joe Perches <joe@...ches.com>,
Kees Cook <keescook@...omium.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Linus Walleij <linus.walleij@...aro.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Manivannan Sadhasivam <mani@...nel.org>,
Marc Zyngier <maz@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Mike Rapoport <rppt@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Pitre <nico@...xnic.net>,
Rob Herring <robh@...nel.org>,
Russell King <linux@...linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>,
Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Valentin Schneider <valentin.schneider@....com>,
Viresh Kumar <viresh.kumar@...aro.org>,
"Wolfram Sang (Renesas)" <wsa+renesas@...g-engineering.com>,
YiFei Zhu <yifeifz2@...inois.edu>
Subject: Re: [PATCH 2/3] ARM: Move thread_info into task_struct (v7 only)
On Tue, 7 Sept 2021 at 17:24, Keith Packard <keithp@...thp.com> wrote:
>
> Ard Biesheuvel <ardb@...nel.org> writes:
>
> > Sure, so it is precisely for that reason that it is better to isolate
> > changes that can be isolated.
>
> I'll go ahead and split this apart then; that is how I did development,
> after all.
>
> > All the time. 'current' essentially never changes value from the POV
> > of code running in task context, so there is usually no reason to care
> > about preemption/migration when referring to it. Using per-CPU
> > variables is what creates the problem here.
>
> Thanks for helping me -- I just got the wrong model stuck in my head
> over the weekend somehow.
>
> If I do have this figured out, we should be able to stick the
> per_cpu_offset value in thread_info and use TPIDRPRW to hold 'current'
> as code using per_cpu_offset should already be disabling
> preemption. That should be an easier change than putting a kernel
> pointer in a user-visible register.
>
That is still a bit tricky, given that you now have to swap out the
per-CPU offset when you migrate a task, and the generic code is not
really set up for that.
> > Given that we are already relying on the MP extensions for this
> > anyway, I personally think that using another thread ID register to
> > carry 'current' is a reasonable approach as well, since it would also
> > allow us to get per-task stack protector support into the compiler.
> > But I would like to hear from some other folks on cc as well.
>
> That would be awesome; I assume that doesn't require leaving
> per_cpu_offset in a thread ID register?
>
> In any case, I'll give my plan a try, and then see about trying your
> plan as well so I can compare the complexity of the two solutions.
>
I had a stab at this myself today (long boring day with no Internet connection).
https://android-kvm.googlesource.com/linux/+log/refs/heads/ardb/arm32-ti-in-task
It resembles your code in some places - I suppose we went on the same
journey in a sense :-) We'll fix up the credits before this gets
resubmitted.
Fixing the per-task stack protector plugin on top of these changes
should be trivial but I need a coffee first.
Powered by blists - more mailing lists