Messages in this thread | | | From | Brian Gerst <> | Date | Thu, 7 Nov 2019 14:24:12 -0500 | Subject | Re: [patch 5/9] x86/ioport: Reduce ioperm impact for sane usage further |
| |
On Wed, Nov 6, 2019 at 4:01 PM Thomas Gleixner <tglx@linutronix.de> wrote: > > Sane ioperm() users only set the few bits in the I/O space which they need to > access. But the update logic of the TSS I/O bitmap copies always from byte > 0 to the last byte in the tasks bitmap which contains a zero permission bit. > > That means that for access only to port 65335 the full 8K bitmap has to be > copied even if all the bytes in the TSS I/O bitmap are already filled with > 0xff. > > Calculate both the position of the first zero bit and the last zero bit to > limit the range which needs to be copied. This does not solve the problem > when the previous tasked had only byte 0 cleared and the next one has only > byte 65535 cleared, but trying to solve that would be too complex and > heavyweight for the context switch path. As the ioperm() usage is very rare > the case which is optimized is the single task/process which uses ioperm().
Here is a different idea: We already map the TSS virtually in cpu_entry_area. Why not page-align the IO bitmap and remap it to the task's bitmap on task switch? That would avoid all copying on task switch.
-- Brian Gerst
| |