Re: [RFC PATCH v2 4/4] arm64: Export id_aar64fpr0 via sysfs

Morten Rasmussen
2020-10-21T14:43:11Z

On Wed, Oct 21, 2020 at 03:09:46PM +0100, Catalin Marinas wrote:
> On Wed, Oct 21, 2020 at 03:33:29PM +0200, Morten Rasmussen wrote:
> > On Wed, Oct 21, 2020 at 01:15:59PM +0100, Catalin Marinas wrote:
> > > one, though not as easy as automatic task placement by the scheduler (my
> > > first preference, followed by the id_* regs and the aarch32 mask, though
> > > not a strong preference for any).
> >
> > Automatic task placement by the scheduler would mean giving up the
> > requirement that the user-space affinity mask must always be honoured.
> > Is that on the table?
>
> I think Peter rejected it but I still find it a nicer interface from a
> dumb application perspective. It may interact badly with cpusets though
> (at least on Android).

Agree that it would be nice for supporting legacy applications. Due to
the cpuset interaction I think there is fair chance that user-space
would want to know the aarch32 cpumask anyway though.

>
> > Killing aarch32 tasks with an empty intersection between the
> > user-space mask and aarch32_mask is not really "automatic" and would
> > require the aarch32 capability to be exposed anyway.
>
> I agree, especially if overriding the user mask is not desirable. But if
> one doesn't play around with cpusets, 32-bit apps would run "fine" with
> the scheduler transparently placing them on the correct CPU.

Ruling out user-space setting affinity is another way of solving the
problem ;-)

> Anyway, if the task placement is entirely off the table, the next thing
> is asking applications to set their own mask and kill them if they do
> the wrong thing. Here I see two possibilities for killing an app:
>
> 1. When it ends up scheduled on a non-AArch32-capable CPU
>
> 2. If the user cpumask (bar the offline CPUs) is not a subset of the
> aarch32_mask
>
> Option 1 is simpler but 2 would be slightly more consistent.

I don't have strong preference. More consistent killing is probably nice
for debugging purposes. If we go with 2, we would go round and kill all
tasks in cpuset (both running and sleeping) if the cpuset mask was
changed to not include aarch32 CPUs?

> There's also the question on whether the kernel should allow an ELF32 to
> be loaded (and potentially killed subsequently) if the user mask is not
> correct on execve().

I wonder how many apps that would handle execve() failing? If we allow
killing, the simplest solution if there is any doubt seems to be just
to kill the task :-)

Morten