OSDN Git Service

x86/io: Speedup schedule out of I/O bitmap user
authorThomas Gleixner <tglx@linutronix.de>
Mon, 11 Nov 2019 22:03:20 +0000 (23:03 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 16 Nov 2019 10:24:01 +0000 (11:24 +0100)
commitecc7e37d4dadd16f6be125ca496feccd05454da4
tree949482b6896f1ffe74505c75b93ad0b6626505fc
parent32f3bf67ee78332f2caec0984cb9d412cd0a3c23
x86/io: Speedup schedule out of I/O bitmap user

There is no requirement to update the TSS I/O bitmap when a thread using it is
scheduled out and the incoming thread does not use it.

For the permission check based on the TSS I/O bitmap the CPU calculates the memory
location of the I/O bitmap by the address of the TSS and the io_bitmap_base member
of the tss_struct. The easiest way to invalidate the I/O bitmap is to switch the
offset to an address outside of the TSS limit.

If an I/O instruction is issued from user space the TSS limit causes #GP to be
raised in the same was as valid I/O bitmap with all bits set to 1 would do.

This removes the extra work when an I/O bitmap using task is scheduled out
and puts the burden on the rare I/O bitmap users when they are scheduled
in.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/include/asm/processor.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/doublefault.c
arch/x86/kernel/ioport.c
arch/x86/kernel/process.c