lkml.org 
[lkml]   [2019]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [patch V2 09/16] x86/ioperm: Move TSS bitmap update to exit to user work
On Mon, Nov 11, 2019 at 2:35 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>
> There is no point to update the TSS bitmap for tasks which use I/O bitmaps
> on every context switch. It's enough to update it right before exiting to
> user space.
>

+
> +static inline void switch_to_bitmap(unsigned long tifp)
> +{
> + /*
> + * Invalidate I/O bitmap if the previous task used it. If the next
> + * task has an I/O bitmap it will handle it on exit to user mode.
> + */
> + if (tifp & _TIF_IO_BITMAP)
> + tss_invalidate_io_bitmap(this_cpu_ptr(&cpu_tss_rw));
> +}

Shouldn't you be invalidating the io bitmap if the *next* task doesn't
use? Or is the rule that, when a non-io-bitmap-using task is running,
even in kernel mode, the io bitmap is always invalid.

As it stands, you need exit_thread() to invalidate the bitmap. I
assume it does, but I can't easily see it in the middle of the series
like this.

IOW your code might be fine, but it could at least use some comments
in appropriate places (exit_to_usermode_loop()?) that we guarantee
that, if the bit is *clear*, then the TSS has the io bitmap marked
invalid. And add an assertion under CONFIG_DEBUG_ENTRY.

Also, do you need to update EXIT_TO_USERMODE_LOOP_FLAGS?

\
 
 \ /
  Last update: 2019-11-12 17:16    [W:0.358 / U:8.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site