[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANaxB-z_Dn4qpDim3Ec29fXpumOCaS0cO4ByatrPWbZYvuopyA@mail.gmail.com>
Date: Fri, 13 Jan 2023 17:16:56 -0800
From: Andrei Vagin <avagin@...il.com>
To: Tycho Andersen <tycho@...ho.pizza>
Cc: Andrei Vagin <avagin@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
Christian Brauner <brauner@...nel.org>,
Andy Lutomirski <luto@...capital.net>,
Juri Lelli <juri.lelli@...hat.com>,
Peter Oskolkov <posk@...gle.com>,
Will Drewry <wad@...omium.org>
Subject: Re: [PATCH 4/5] seccomp: add the synchronous mode for seccomp_unotify
On Thu, Jan 12, 2023 at 7:00 AM Tycho Andersen <tycho@...ho.pizza> wrote:
>
> On Tue, Jan 10, 2023 at 01:30:09PM -0800, Andrei Vagin wrote:
> > From: Andrei Vagin <avagin@...il.com>
> >
> > seccomp_unotify allows more privileged processes do actions on behalf
> > of less privileged processes.
> >
> > In many cases, the workflow is fully synchronous. It means a target
> > process triggers a system call and passes controls to a supervisor
> > process that handles the system call and returns controls to the target
> > process. In this context, "synchronous" means that only one process is
> > running and another one is waiting.
> >
> > There is the WF_CURRENT_CPU flag that is used to advise the scheduler to
> > move the wakee to the current CPU. For such synchronous workflows, it
> > makes context switches a few times faster.
> >
> > Right now, each interaction takes 12盜. With this patch, it takes about
> > 3盜.
> >
> > This change introduces the SECCOMP_USER_NOTIF_FD_SYNC_WAKE_UP flag that
> > it used to enable the sync mode.
>
> What about just not having a flag and using the new primitives all the
> time? Is there any reason not to?
I was thinking about that but then I decided that it can have a
negative impact in cases
when workflows are not synchronous. This can happen when one process wakes up
another one and continues running on cpu. With the flag, both
processes are scheduled
on the same cpu. Without the flag, they can be scheduled on different
cpu-s and run
concurrently.
In the seccomp unotify, switches from tracee to supervisor are always
synchronous.
Switches into the opposite direction can be either type.
I think it is better to let users decide what type is more suitable
for their workloads.
Thanks,
Andrei
Powered by blists - more mailing lists