Borislav Petkov
1e66e2b862
x86/apic: Use dead_cpu instead of current CPU when cleaning up
...
x2apic_dead_cpu() cleans up the leftovers of a CPU which got unplugged, but
instead of clearing the dead cpu bit in the cluster mask it clears the
current (alive) cpu bit. Noticed because smp_processor_id() is called in
preemptible code and triggers a debug warning.
[ tglx: Rewrote changelog ]
Fixes: 023a611748
("x86/apic/x2apic: Simplify cluster management")
Signed-off-by: Borislav Petkov <bp@suse.de >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Link: https://lkml.kernel.org/r/20170926170845.13955-1-bp@alien8.de
2017-09-27 09:37:41 +02:00
Ingo Molnar
8474c532b5
Merge branch 'WIP.x86/fpu' into x86/fpu, because it's ready
...
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 10:17:43 +02:00
Eric Biggers
738f48cb5f
x86/fpu: Use using_compacted_format() instead of open coded X86_FEATURE_XSAVES
...
This is the canonical method to use.
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-11-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:48 +02:00
Eric Biggers
98c0fad9d6
x86/fpu: Use validate_xstate_header() to validate the xstate_header in copy_user_to_xstate()
...
Tighten the checks in copy_user_to_xstate().
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-10-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:48 +02:00
Eric Biggers
3d703477bc
x86/fpu: Eliminate the 'xfeatures' local variable in copy_user_to_xstate()
...
We now have this field in hdr.xfeatures.
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-9-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:48 +02:00
Eric Biggers
af2c4322d9
x86/fpu: Copy the full header in copy_user_to_xstate()
...
This is in preparation to verify the full xstate header as supplied by user-space.
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-8-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:47 +02:00
Eric Biggers
af95774b3c
x86/fpu: Use validate_xstate_header() to validate the xstate_header in copy_kernel_to_xstate()
...
Tighten the checks in copy_kernel_to_xstate().
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-7-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:47 +02:00
Eric Biggers
b89eda482d
x86/fpu: Eliminate the 'xfeatures' local variable in copy_kernel_to_xstate()
...
We have this information in the xstate_header.
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-6-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:46 +02:00
Eric Biggers
80d8ae86b3
x86/fpu: Copy the full state_header in copy_kernel_to_xstate()
...
This is in preparation to verify the full xstate header as supplied by user-space.
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-5-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:46 +02:00
Eric Biggers
b11e2e18a7
x86/fpu: Use validate_xstate_header() to validate the xstate_header in __fpu__restore_sig()
...
Tighten the checks in __fpu__restore_sig() and update comments.
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-4-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:46 +02:00
Eric Biggers
cf9df81b13
x86/fpu: Use validate_xstate_header() to validate the xstate_header in xstateregs_set()
...
Tighten the checks in xstateregs_set().
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-3-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:45 +02:00
Eric Biggers
e63e5d5c15
x86/fpu: Introduce validate_xstate_header()
...
Move validation of user-supplied xstate_header into a helper function,
in preparation of calling it from both the ptrace and sigreturn syscall
paths.
The new function also considers it to be an error if *any* reserved bits
are set, whereas before we were just clearing most of them silently.
This should reduce the chance of bugs that fail to correctly validate
user-supplied XSAVE areas. It also will expose any broken userspace
programs that set the other reserved bits; this is desirable because
such programs will lose compatibility with future CPUs and kernels if
those bits are ever used for anything. (There shouldn't be any such
programs, and in fact in the case where the compacted format is in use
we were already validating xfeatures. But you never know...)
Signed-off-by: Eric Biggers <ebiggers@google.com >
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Dmitry Vyukov <dvyukov@google.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Kees Cook <keescook@chromium.org >
Cc: Kevin Hao <haokexin@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Halcrow <mhalcrow@google.com >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Wanpeng Li <wanpeng.li@hotmail.com >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Cc: kernel-hardening@lists.openwall.com
Link: http://lkml.kernel.org/r/20170924105913.9157-2-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:45 +02:00
Ingo Molnar
369a036de2
x86/fpu: Rename fpu__activate_fpstate_read/write() to fpu__prepare_[read|write]()
...
As per the new nomenclature we don't 'activate' the FPU state
anymore, we initialize it. So drop the _activate_fpstate name
from these functions, which were a bit of a mouthful anyway,
and name them:
fpu__prepare_read()
fpu__prepare_write()
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: H. Peter Anvin <hpa@zytor.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:44 +02:00
Ingo Molnar
2ce03d850b
x86/fpu: Rename fpu__activate_curr() to fpu__initialize()
...
Rename this function to better express that it's all about
initializing the FPU state of a task which goes hand in hand
with the fpu::initialized field.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Link: http://lkml.kernel.org/r/20170923130016.21448-33-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:44 +02:00
Ingo Molnar
e10078eba6
x86/fpu: Simplify and speed up fpu__copy()
...
fpu__copy() has a preempt_disable()/enable() pair, which it had to do to
be able to atomically unlazy the current task when doing an FNSAVE.
But we don't unlazy tasks anymore, we always do direct saves/restores of
FPU context.
So remove both the unnecessary critical section, and update the comments.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Link: http://lkml.kernel.org/r/20170923130016.21448-32-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:44 +02:00
Ingo Molnar
7f1487c59b
x86/fpu: Fix stale comments about lazy FPU logic
...
We don't do any lazy restore anymore, what we have are two pieces of optimization:
- no-FPU tasks that don't save/restore the FPU context (kernel threads are such)
- cached FPU registers maintained via the fpu->last_cpu field. This means that
if an FPU task context switches to a non-FPU task then we can maintain the
FPU registers as an in-FPU copies (cache), and skip the restoration of them
once we switch back to the original FPU-using task.
Update all the comments that still referred to old 'lazy' and 'unlazy' concepts.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Link: http://lkml.kernel.org/r/20170923130016.21448-31-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:43 +02:00
Ingo Molnar
e4a81bfcaa
x86/fpu: Rename fpu::fpstate_active to fpu::initialized
...
The x86 FPU code used to have a complex state machine where both the FPU
registers and the FPU state context could be 'active' (or inactive)
independently of each other - which enabled features like lazy FPU restore.
Much of this complexity is gone in the current code: now we basically can
have FPU-less tasks (kernel threads) that don't use (and save/restore) FPU
state at all, plus full FPU users that save/restore directly with no laziness
whatsoever.
But the fpu::fpstate_active still carries bits of the old complexity - meanwhile
this flag has become a simple flag that shows whether the FPU context saving
area in the thread struct is initialized and used, or not.
Rename it to fpu::initialized to express this simplicity in the name as well.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Link: http://lkml.kernel.org/r/20170923130016.21448-30-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:43:36 +02:00
Ingo Molnar
685c930d6e
x86/fpu: Remove fpu__current_fpstate_write_begin/end()
...
These functions are not used anymore, so remove them.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Bobby Powers <bobbypowers@gmail.com >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Link: http://lkml.kernel.org/r/20170923130016.21448-29-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:42:20 +02:00
Ingo Molnar
4618e90965
x86/fpu: Fix fpu__activate_fpstate_read() and update comments
...
fpu__activate_fpstate_read() can be called for the current task
when coredumping - or for stopped tasks when ptrace-ing.
Implement this properly in the code and update the comments.
This also fixes an incorrect (but harmless) warning introduced by
one of the earlier patches.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Andy Lutomirski <luto@amacapital.net >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: Eric Biggers <ebiggers3@gmail.com >
Cc: Fenghua Yu <fenghua.yu@intel.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Oleg Nesterov <oleg@redhat.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Rik van Riel <riel@redhat.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Yu-cheng Yu <yu-cheng.yu@intel.com >
Link: http://lkml.kernel.org/r/20170923130016.21448-28-mingo@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-26 09:41:09 +02:00
Thomas Gleixner
d6ffc6ac83
x86/vector: Respect affinity mask in irq descriptor
...
The interrupt descriptor has a preset affinity mask at allocation
time, which is usually the default affinity mask.
The current code does not respect that mask and places the vector at some
random CPU, which gets corrected later by a set_affinity() call. That's
silly because the vector allocation can respect the mask upfront and place
the interrupt on a CPU which is in the mask. If that fails, then the
affinity is broken and a interrupt assigned on any online CPU.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213156.431670325@linutronix.de
2017-09-25 20:52:03 +02:00
Thomas Gleixner
2cffad7bad
x86/irq: Simplify hotplug vector accounting
...
Before a CPU is taken offline the number of active interrupt vectors on the
outgoing CPU and the number of vectors which are available on the other
online CPUs are counted and compared. If the active vectors are more than
the available vectors on the other CPUs then the CPU hot-unplug operation
is aborted. This again uses loop based search and is inaccurate.
The bitmap matrix allocator has accurate accounting information and can
tell exactly whether the vector space is sufficient or not.
Emit a message when the number of globaly reserved (unallocated) vectors is
larger than the number of available vectors after offlining a CPU because
after that point request_irq() might fail.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213156.351193962@linutronix.de
2017-09-25 20:52:02 +02:00
Thomas Gleixner
464d12309e
x86/vector: Switch IOAPIC to global reservation mode
...
IOAPICs install and allocate vectors for inactive interrupts. This results
in problems on CPU offline and wastes vector resources for nothing.
Handle inactive IOAPIC interrupts in the same way as inactive MSI
interrupts and switch them to the global reservation mode.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213156.273454591@linutronix.de
2017-09-25 20:52:02 +02:00
Thomas Gleixner
4900be8360
x86/vector/msi: Switch to global reservation mode
...
Devices with many queues allocate a huge number of interrupts and get
assigned a vector for each of them, even if the queues are not active and
the interrupts never requested. This causes problems with the decision
whether the global vector space is sufficient for CPU hot unplug
operations.
Change it to a reservation scheme, which allows overcommitment.
When the interrupt is allocated and initialized the vector assignment
merily updates the reservation request counter in the matrix
allocator. This counter is used to emit warnings when the reservation
exceeds the available vector space, but does not affect CPU offline
operations. Like the managed interrupts the corresponding MSI/DMAR/IOAPIC
entries are directed to the special shutdown vector.
When the interrupt is requested, then the activation code tries to assign a
real vector. If that succeeds the interrupt is started up and functional.
If that fails, then subsequently request_irq() fails with -ENOSPC.
This allows a clear separation of inactive and active modes and simplifies
the final decisions whether the global vector space is sufficient for CPU
offline operations.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213156.184211133@linutronix.de
2017-09-25 20:52:02 +02:00
Thomas Gleixner
2db1f959d9
x86/vector: Handle managed interrupts proper
...
Managed interrupts need to reserve interrupt vectors permanently, but as
long as the interrupt is deactivated, the vector should not be active.
Reserve a new system vector, which can be used to initially initialize
MSI/DMAR/IOAPIC entries. In that situation the interrupts are disabled in
the corresponding MSI/DMAR/IOAPIC devices. So the vector should never be
sent to any CPU.
When the managed interrupt is started up, a real vector is assigned from
the managed vector space and configured in MSI/DMAR/IOAPIC.
This allows a clear separation of inactive and active modes and simplifies
the final decisions whether the global vector space is sufficient for CPU
offline operations.
The vector space can be reserved even on offline CPUs and will survive CPU
offline/online operations.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213156.104616625@linutronix.de
2017-09-25 20:52:01 +02:00
Thomas Gleixner
90ad9e2d91
x86/io_apic: Reevaluate vector configuration on activate()
...
With the upcoming reservation/management scheme, early activation will
assign a special vector. The final activation at request_irq() assigns a
real vector, which needs to be updated in the ioapic.
Split out the reconfiguration code in set_affinity and use it for
reactivation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213156.025232175@linutronix.de
2017-09-25 20:52:01 +02:00
Thomas Gleixner
2a85386a73
x86/apic/msi: Force reactivation of interrupts at startup time
...
MSI(X) interrupts need a valid vector configuration early at allocation
time, i.e. before the PCI core enables MSI(X).
With managed interrupts and the new global reservation scheme, the early
configuration will not assign a real device vector, but a special shutdown
vector. When the irq is started up, then the interrupt must be
reconfigured. Tell the MSI irqdomain core about it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.774066582@linutronix.de
2017-09-25 20:52:00 +02:00
Thomas Gleixner
ba224feac8
x86/vector: Untangle internal state from irq_cfg
...
The vector management state is not required to live in irq_cfg. irq_cfg is
only relevant for the depending irq domains (IOAPIC, DMAR, MSI ...).
The seperation of the vector management status allows to direct a shut down
interrupt to a special shutdown vector w/o confusing the internal state of
the vector management.
Preparatory change for the rework of managed interrupts and the global
vector reservation scheme.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.683712356@linutronix.de
2017-09-25 20:51:59 +02:00
Thomas Gleixner
ba801640b1
x86/vector: Compile SMP only code conditionally
...
No point in compiling this for UP.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.603191841@linutronix.de
2017-09-25 20:51:59 +02:00
Thomas Gleixner
baab1e84b1
x86/apic: Remove unused callbacks
...
Now that the old allocator is gone, these apic functions are unused. Remove
them.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.524662349@linutronix.de
2017-09-25 20:51:58 +02:00
Thomas Gleixner
69cde0004a
x86/vector: Use matrix allocator for vector assignment
...
Replace the magic vector allocation code by a simple bitmap matrix
allocator. This avoids loops and hoops over CPUs and vector arrays, so in
case of densly used vector spaces it's way faster.
This also gets rid of the magic 'spread the vectors accross priority
levels' heuristics in the current allocator:
The comment in __asign_irq_vector says:
* NOTE! The local APIC isn't very good at handling
* multiple interrupts at the same interrupt level.
* As the interrupt level is determined by taking the
* vector number and shifting that right by 4, we
* want to spread these out a bit so that they don't
* all fall in the same interrupt level.
After doing some palaeontological research the following was found the
following in the PPro Developer Manual Volume 3:
"7.4.2. Valid Interrupts
The local and I/O APICs support 240 distinct vectors in the range of 16
to 255. Interrupt priority is implied by its vector, according to the
following relationship: priority = vector / 16
One is the lowest priority and 15 is the highest. Vectors 16 through
31 are reserved for exclusive use by the processor. The remaining
vectors are for general use. The processor's local APIC includes an
in-service entry and a holding entry for each priority level. To avoid
losing inter- rupts, software should allocate no more than 2 interrupt
vectors per priority."
The current SDM tells nothing about that, instead it states:
"If more than one interrupt is generated with the same vector number,
the local APIC can set the bit for the vector both in the IRR and the
ISR. This means that for the Pentium 4 and Intel Xeon processors, the
IRR and ISR can queue two interrupts for each interrupt vector: one
in the IRR and one in the ISR. Any additional interrupts issued for
the same interrupt vector are collapsed into the single bit in the
IRR.
For the P6 family and Pentium processors, the IRR and ISR registers
can queue no more than two interrupts per interrupt vector and will
reject other interrupts that are received within the same vector."
Which means, that on P6/Pentium the APIC will reject a new message and
tell the sender to retry, which increases the load on the APIC bus and
nothing more.
There is no affirmative answer from Intel on that, but it's a sane approach
to remove that for the following reasons:
1) No other (relevant Open Source) operating systems bothers to
implement this or mentiones this at all.
2) The current allocator has no enforcement for this and especially the
legacy interrupts, which are the main source of interrupts on these
P6 and older systmes, are allocated linearly in the same priority
level and just work.
3) The current machines have no problem with that at all as verified
with some experiments.
4) AMD at least confirmed that such an issue is unknown.
5) P6 and older are dinosaurs almost 20 years EOL, so there is really
no reason to worry about that too much.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.443678104@linutronix.de
2017-09-25 20:51:58 +02:00
Thomas Gleixner
8d1e3dca7d
x86/vector: Add tracepoints for vector management
...
Add tracepoints for analysing the new vector management
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.357986795@linutronix.de
2017-09-25 20:51:58 +02:00
Thomas Gleixner
8ed4f3e666
x86/smpboot: Set online before setting up vectors
...
There is no reason to set the CPU online after establishing the vectors on
the upcoming CPU. The vector space is protected by the vector lock so no
changes can happen.
Marking the CPU online before setting up the vector space makes tracing
work in the early vector management cpu online code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.264311994@linutronix.de
2017-09-25 20:51:57 +02:00
Thomas Gleixner
65d7ed57bd
x86/vector: Add vector domain debugfs support
...
Add the debug callback for the vector domain, which gives a detailed
information about vector usage if invoked for the domain by using rhe
matrix allocator debug function and vector/target information when invoked
for a particular interrupt.
Extra information foir the Vector domain:
Online bitmaps: 32
Global available: 6352
Global reserved: 5
Total allocated: 20
System: 41: 0-19,32,50,128,238-255
| CPU | avl | man | act | vectors
0 183 4 19 33-48,51-53
1 199 4 1 33
2 199 4 0
Extra information for interrupts:
Vector: 42
Target: 4
This allows a detailed analysis of the vector usage and the association to
interrupts and devices.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.188137174@linutronix.de
2017-09-25 20:51:57 +02:00
Thomas Gleixner
0fa115da40
x86/irq/vector: Initialize matrix allocator
...
Initialize the matrix allocator and add the proper accounting points to the
code.
No functional change, just preparation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213155.108410660@linutronix.de
2017-09-25 20:51:56 +02:00
Thomas Gleixner
9f9e3bb1cf
x86/apic: Add replacement for cpu_mask_to_apicid()
...
As preparation for replacing the vector allocator, provide a new function
which takes a cpu number instead of a cpu mask to calculate/lookup the
resulting APIC destination id.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
2017-09-25 20:51:56 +02:00
Thomas Gleixner
99a1482d8a
x86/vector: Move helper functions around
...
Move the helper functions to a different place as they would end up in the
middle of management functions.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.949581934@linutronix.de
2017-09-25 20:51:56 +02:00
Thomas Gleixner
258d86eef9
x86/vector: Remove pointless pointer checks
...
The info pointer checks in assign_irq_vector_policy() are pointless because
the pointer cannot be NULL, otherwise the calling code would already crash.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.859484148@linutronix.de
2017-09-25 20:51:55 +02:00
Thomas Gleixner
4ef76eb6de
x86/apic: Get rid of the legacy irq data storage
...
Now that the legacy PIC takeover by the IOAPIC is marked accordingly the
early boot allocation of APIC data is not longer necessary. Use the regular
allocation mechansim as it is used by non legacy interrupts and fill in the
known information (vector and affinity) so the allocator reuses the vector,
This is important as the timer check might move the timer interrupt 0 back
to the PIC in case the delivery through the IOAPIC fails.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.780521549@linutronix.de
2017-09-25 20:51:55 +02:00
Thomas Gleixner
3534be05e4
x86/ioapic: Mark legacy vectors at reallocation time
...
When the legacy PIC vectors are taken over by the IO APIC the current
vector assignement code is tricked to reuse the vector by allocating the
apic data in the early boot process. This can be avoided by marking the
allocation as legacy PIC take over. Preparatory patch for further cleanups.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.700501979@linutronix.de
2017-09-25 20:51:54 +02:00
Thomas Gleixner
dccfe3147b
x86/vector: Simplify vector move cleanup
...
The vector move cleanup needs to walk the vector space and do a lot of
sanity checks to find a vector to cleanup.
With single CPU affinities this can be simplified and made more robust by
queueing the vector configuration which needs to be cleaned up in a hlist
on the CPU which was the previous target.
That removes all the race conditions because the cleanup either finds a
valid list entry or not. The latter happens when the interrupt was torn
down before the cleanup handler was able to run.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.622727892@linutronix.de
2017-09-25 20:51:54 +02:00
Thomas Gleixner
029c6e1c9d
x86/vector: Store the single CPU targets in apic data
...
Now that the interrupt affinities are targeted at single CPUs storing them
in a cpumask is overkill. Store them in a dedicated variable.
This does not yet remove the domain cpumasks because the current allocator
relies on them. Preparatory change for the allocator rework.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.544867277@linutronix.de
2017-09-25 20:51:54 +02:00
Thomas Gleixner
86ba65514f
x86/vector: Cleanup variable names
...
The naming convention of variables with the types irq_data and
apic_chip_data are inconsistent and confusing.
Before reworking the whole vector management make them consistent so
irq_data pointers are named 'irqd' and apic_chip_data are named 'apicd' all
over the place.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.465731667@linutronix.de
2017-09-25 20:51:53 +02:00
Thomas Gleixner
f0cc6ccaf7
x86/vector: Simplify the CPU hotplug vector update
...
With single CPU affinities it's not longer required to scan all interrupts
for potential destination masks which contain the newly booting CPU.
Reduce it to install the active legacy PIC vectors on the newly booting CPU
as those cannot be affinity controlled by the kernel and potentially end up
at any CPU in the system.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.388040204@linutronix.de
2017-09-25 20:51:53 +02:00
Thomas Gleixner
ef9e56d894
x86/ioapic: Remove obsolete post hotplug update
...
With single CPU affinities the post SMP boot vector update is pointless as
it will just leave the affinities on the same vectors and the same CPUs.
Remove it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.308697243@linutronix.de
2017-09-25 20:51:52 +02:00
Thomas Gleixner
fdba46ffb4
x86/apic: Get rid of multi CPU affinity
...
Setting the interrupt affinity of a single interrupt to multiple CPUs has a
dubious value.
1) This only works on machines where the APIC uses logical destination
mode. If the APIC uses physical destination mode then it is already
restricted to a single CPU
2) Experiments have shown, that the benefit of multi CPU affinity is close
to zero and in some test even worse than setting the affinity to a
single CPU.
The reason for this is that the delivery targets the APIC with the
lowest ID first and only if that APIC is busy (servicing an interrupt,
i.e. ISR is not empty) it hands it over to the next APIC. In the
conducted tests the vast majority of interrupts ends up on the APIC
with the lowest ID anyway, so there is no natural spreading of the
interrupts possible.
Supporting multi CPU affinities adds a lot of complexity to the code, which
can turn the allocation search into a worst case of
nr_vectors * nr_online_cpus * nr_bits_in_target_mask
As a first step disable it by restricting the vector search to a single
CPU.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.228824430@linutronix.de
2017-09-25 20:51:52 +02:00
Thomas Gleixner
7854f82293
x86/vector: Rename used_vectors to system_vectors
...
used_vectors is a nisnomer as it only has the system vectors which are
excluded from the regular vector allocation marked. It's not what the name
suggests storage for the actually used vectors.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.150209009@linutronix.de
2017-09-25 20:51:52 +02:00
Thomas Gleixner
c1d1ee9ac1
x86/apic: Get rid of apic->target_cpus
...
The target_cpus() callback of the apic struct is not really useful. Some
APICs return cpu_online_mask and others cpus_all_mask. The latter is bogus
as it does not take holes in the cpus_possible_mask into account.
Replace it with cpus_online_mask which makes the most sense and remove the
callback.
The usage sites will be removed in a later step anyway, so get rid of it
now to have incremental changes.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213154.070850916@linutronix.de
2017-09-25 20:51:51 +02:00
Thomas Gleixner
023a611748
x86/apic/x2apic: Simplify cluster management
...
The cluster management code creates a cluster mask per cpu, which requires
that on cpu on/offline all cluster masks have to be iterated and
updated. Other information about the cluster is in different per cpu
variables.
Create a data structure which holds all information about a cluster and
fill it in when the first CPU of a cluster comes online. If another CPU of
a cluster comes online it just finds the pointer to the existing cluster
structure and reuses it.
That simplifies all usage sites and gets rid of quite some pointless
iterations over the online cpus to find the cpus which belong to the
cluster.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213153.992629420@linutronix.de
2017-09-25 20:51:51 +02:00
Thomas Gleixner
83a105229c
x86/apic: Move common APIC callbacks
...
Move more apic struct specific functions out of the header and the apic
management code into the common source file.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213153.834421893@linutronix.de
2017-09-25 20:51:50 +02:00
Thomas Gleixner
6406350583
x86/apic: Sanitize 32/64bit APIC callbacks
...
The 32bit and the 64bit implementation of default_cpu_present_to_apicid()
and default_check_phys_apicid_present() are exactly the same, but
implemented and located differently.
Move them to common apic code and get rid of the pointless difference.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Tested-by: Juergen Gross <jgross@suse.com >
Tested-by: Yu Chen <yu.c.chen@intel.com >
Acked-by: Juergen Gross <jgross@suse.com >
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com >
Cc: Tony Luck <tony.luck@intel.com >
Cc: Marc Zyngier <marc.zyngier@arm.com >
Cc: Alok Kataria <akataria@vmware.com >
Cc: Joerg Roedel <joro@8bytes.org >
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net >
Cc: Steven Rostedt <rostedt@goodmis.org >
Cc: Christoph Hellwig <hch@lst.de >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Paolo Bonzini <pbonzini@redhat.com >
Cc: Rui Zhang <rui.zhang@intel.com >
Cc: "K. Y. Srinivasan" <kys@microsoft.com >
Cc: Arjan van de Ven <arjan@linux.intel.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Len Brown <lenb@kernel.org >
Link: https://lkml.kernel.org/r/20170913213153.757329991@linutronix.de
2017-09-25 20:51:50 +02:00