Re: [patch V3 12/20] x86/ioperm: Move TSS bitmap update to exit to user work
From: Linus Torvalds
Date: Wed Nov 13 2019 - 16:20:03 EST
On Wed, Nov 13, 2019 at 1:02 PM Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> 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.
Hmm.
I wonder if it might make sense to delay it even more: just always
invalidate the bitmap on task switch, and leave it at that.
And then on GP fault, just add trivial logic like
if (I_have_an_io_bitmap && it_isnt_installed) {
install_io_bitmap();
return;
}
and now you do get that extra GP fault if you actually use IO
accesses, but the normal case has zero overhead.
Even processes that do ioperm may not be *using* it all the time.
Linus