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
Thomas Gleixner
1da91779e1
x86/apic: Move APIC noop specific functions
...
Move more inlines to the place where they belong.
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.677743545@linutronix.de
2017-09-25 20:51:49 +02:00
Thomas Gleixner
0801bbaac0
x86/apic: Move probe32 specific APIC functions
...
The apic functions which are used in probe_32.c are implemented as inlines
or in apic.c. There is no reason to have them at random places.
Move them to the actual usage site and make them static.
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.596768194@linutronix.de
2017-09-25 20:51:49 +02:00
Thomas Gleixner
57e0aa4461
x86/apic: Sanitize return value of check_apicid_used()
...
The check is boolean, but the function returns unsigned long for no value.
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.516730518@linutronix.de
2017-09-25 20:51:49 +02:00
Thomas Gleixner
727657e620
x86/apic: Sanitize return value of apic.set_apic_id()
...
The set_apic_id() callback returns an unsigned long value which is handed
in to apic_write() as the value argument u32.
Adjust the return value so it returns u32 right away.
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.437208268@linutronix.de
2017-09-25 20:51:48 +02:00
Thomas Gleixner
981c2eac1c
x86/apic: Deinline x2apic functions
...
These inline functions are used in both the cluster and the physical x2apic
code to fill in the function pointers of the apic structure. That means the
code is generated twice for no reason.
Move it to a C code and reuse 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/20170913213153.358954066@linutronix.de
2017-09-25 20:51:48 +02:00
Thomas Gleixner
e4ae4c8ea7
Merge branch 'irq/core' into x86/apic
...
Pick up the dependencies for the vector management rework series.
2017-09-25 20:39:01 +02:00
Thomas Gleixner
42e1cc2dc5
genirq/irqdomain: Propagate early activation
...
Propagate the early activation mode to the irqdomain activate()
callbacks. This is required for the upcoming reservation, late vector
assignment scheme, so that the early activation call can act accordingly.
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.028353660@linutronix.de
2017-09-25 20:38:25 +02:00
Thomas Gleixner
7249164346
genirq/irqdomain: Update irq_domain_ops.activate() signature
...
The irq_domain_ops.activate() callback has no return value and no way to
tell the function that the activation is early.
The upcoming changes to support a reservation scheme which allows to assign
interrupt vectors on x86 only when the interrupt is actually requested
requires:
- A return value, so activation can fail at request_irq() time
- Information that the activate invocation is early, i.e. before
request_irq().
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/20170913213152.848490816@linutronix.de
2017-09-25 20:38:24 +02:00
Dou Liyang
ae41a2a40e
x86/apic: Use lapic_is_integrated() consistently
...
lapic_is_integrated() is a wrapper around APIC_INTEGRATED(), but not used
consistently.
Replace the direct usage of APIC_INTEGRATED() and fixup a hard to read tail
comment. No functional change.
[ tglx: Made it compile and work .... ]
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1504774161-7137-2-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:19:43 +02:00
Dou Liyang
e3cccbce14
x86/apic: Remove duplicate X86_64 conditional in lapic_is_integrated()
...
The macro APIC_INTEGRATED(x) is already wrapped by CONFIG_X86_32. So
it can be invoked unconditionally.
Remove the extra "#ifdef CONFIG_X86_64...". No functional change.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1504774161-7137-1-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:19:43 +02:00
Dou Liyang
b371ae0d4a
x86/apic: Remove init_bsp_APIC()
...
init_bsp_APIC() which works for the virtual wire mode is used in ISA irq
initialization at boot time.
With the new APIC interrupt delivery mode scheme, which initializes the
APIC before the first interrupt is expected, init_bsp_APIC() is not longer
required and can be removed.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-13-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:12:37 +02:00
Dou Liyang
935356cecd
x86/apic: Initialize interrupt mode after timer init
...
A cold or warm boot through BIOS sets the APIC in default interrupt
delivery mode. A dump-capture kernel will not go through a BIOS reset and
leave the interrupt delivery mode in the state which was active on the
crashed kernel, but the dump kernel startup code assumes default delivery
mode which can result in interrupt delivery/handling to fail.
To solve this problem, it's required to set up the final interrupt delivery
mode as soon as possible. As IOAPIC setup needs the timer initialized for
verifying the timer interrupt delivery mode, the earliest point is right
after timer setup in late_time_init().
That results in the following init order:
1) Set up the legacy timer, if applicable on the platform
2) Set up APIC/IOAPIC which includes the verification of the legacy timer
interrupt delivery.
3) TSC calibration
4) Local APIC timer setup
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-12-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:17 +02:00
Dou Liyang
34fba3e6b1
x86/init: Add intr_mode_init to x86_init_ops
...
X86 and XEN initialize interrupt delivery mode in different way.
To avoid conditionals, add a new x86_init_ops function which defaults to
the standard function and can be overridden by the early XEN platform code.
[ tglx: Folded the XEN part which was a separate patch to preserve
bisectability ]
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-10-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:17 +02:00
Dou Liyang
ca7c6076ba
x86/ioapic: Refactor the delay logic in timer_irq_works()
...
timer_irq_works() is used to detects the timer IRQs. It calls mdelay(10) to
delay ten ticks and check whether the timer IRQ work or not.
mdelay() depends on the loops_per_jiffy which is set up in
calibrate_delay(), but the delay calibration depends on a working timer
interrupt, which causes a chicken and egg problem.
The correct solution is to set up the interrupt mode and making sure that
the timer interrupt is delivered correctly before invoking calibrate_delay().
That means that mdelay() cannot be used in timer_irq_works().
Provide helper functions to make a rough delay estimate which is good enough
to prove that the timer interrupt is working. Either use TSC or a simple
delay loop and assume that 4GHz is the maximum CPU frequency to base the
delay calculation on.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-9-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:16 +02:00
Dou Liyang
0c759131ae
x86/apic: Unify interrupt mode setup for UP system
...
In UniProcessor kernel with UP_LATE_INIT=y, the interrupt delivery mode is
initialized in up_late_init().
Use the new unified apic_intr_mode_init() function and remove
APIC_init_uniprocessor().
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-8-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:16 +02:00
Dou Liyang
4f45ed9f84
x86/apic: Mark the apic_intr_mode extern for sanity check cleanup
...
Calling native_smp_prepare_cpus() to prepare for SMP bootup, does some
sanity checking, enables APIC mode and disables SMP feature.
Now, APIC mode setup has been unified to apic_intr_mode_init(), some sanity
checks are redundant and need to be cleanup.
Mark the apic_intr_mode extern to refine the switch and remove the
redundant sanity check.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-7-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:16 +02:00
Dou Liyang
3e730dad3b
x86/apic: Unify interrupt mode setup for SMP-capable system
...
On a SMP-capable system, the kernel enables and sets up the APIC interrupt
delivery mode in native_smp_prepare_cpus(). The decision how to setup the
APIC is intermingled with the decision of setting up SMP or not.
Split the initialization of the APIC interrupt mode independent from other
decisions and have a separate apic_intr_mode_init() function for it.
The invocation time stays the same for now.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-6-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:15 +02:00
Dou Liyang
4b1244b45c
x86/apic: Move logical APIC ID away from apic_bsp_setup()
...
apic_bsp_setup() sets and returns logical APIC ID for initializing
cpu0_logical_apicid in a SMP-capable system.
The id has nothing to do with the initialization of local APIC and I/O
APIC. And apic_bsp_setup() should be called for interrupt mode setup only.
Move the id setup into a separate helper function for cleanup and mark
apic_bsp_setup() void.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-5-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:15 +02:00
Dou Liyang
a2510d156e
x86/apic: Split local APIC timer setup from the APIC setup
...
apic_bsp_setup() sets up the local APIC, I/O APIC and APIC timer.
The local APIC and I/O APIC setup belongs to interrupt delivery mode
setup. Setting up the local APIC timer for booting CPU is another job
and has nothing to do with interrupt delivery mode setup.
Split local APIC timer setup from the APIC setup, keep it in the original
position for SMP and UP kernel for now.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-4-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:14 +02:00
Dou Liyang
4b1669e8d1
x86/apic: Prepare for unifying the interrupt delivery modes setup
...
There are three places which initialize the interrupt delivery modes:
1) init_bsp_APIC() which is called early might setup the through-local-APIC
virtual wire mode on non SMP systems.
2) In an SMP-capable system, native_smp_prepare_cpus() tries to switch to
symmetric I/O model.
3) In UP system with UP_LATE_INIT=y, the local APIC and I/O APIC are set up
in smp_init().
There is no technical reason to make these initializations at random places
and run the kernel with the potentially wrong mode through the early boot
stage, but it has a problematic side effect: The late switch to symmetric
I/O mode causes dump-capture kernel to hang when the kernel command line
option 'notsc' is active.
Provide a new function to unify that three positions. Preparatory patch to
initialize an interrupt mode directly.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-3-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:14 +02:00
Dou Liyang
0114a8e877
x86/apic: Construct a selector for the interrupt delivery mode
...
There are quite some switches which are used to determine the final
interrupt delivery mode, as shown below:
1) Kconfig: CONFIG_X86_64; CONFIG_X86_LOCAL_APIC; CONFIG_x86_IO_APIC
2) Command line options: disable_apic; skip_ioapic_setup
3) CPU Capability: boot_cpu_has(X86_FEATURE_APIC)
4) MP table: smp_found_config
5) ACPI: acpi_lapic; acpi_ioapic; nr_ioapic
These switches are disordered and scattered and there are also some
dependencies between them. These make the code difficult to maintain and
read.
Construct a selector to unify them into a single function, then, Use this
selector to get an interrupt delivery mode directly.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: yinghai@kernel.org
Cc: bhe@redhat.com
Link: https://lkml.kernel.org/r/1505293975-26005-2-git-send-email-douly.fnst@cn.fujitsu.com
2017-09-25 15:03:14 +02:00
Linus Torvalds
680352bda5
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
...
Pull x86 fixes from Ingo Molnar:
"Two fixes: dead code removal, plus a SME memory encryption fix on
32-bit kernels that crashed Xen guests"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/cpu: Remove unused and undefined __generic_processor_info() declaration
x86/mm: Make the SME mask a u64
2017-09-12 11:34:39 -07:00
Dou Liyang
e2329b4252
x86/cpu: Remove unused and undefined __generic_processor_info() declaration
...
The following revert:
2b85b3d229
("x86/acpi: Restore the order of CPU IDs")
... got rid of __generic_processor_info(), but forgot to remove its
declaration in mpspec.h.
Remove the declaration and update the comments as well.
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: lenb@kernel.org
Link: http://lkml.kernel.org/r/1505101403-29100-1-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-09-11 08:16:37 +02:00
Alexey Dobriyan
9b130ad5bb
treewide: make "nr_cpu_ids" unsigned
...
First, number of CPUs can't be negative number.
Second, different signnnedness leads to suboptimal code in the following
cases:
1)
kmalloc(nr_cpu_ids * sizeof(X));
"int" has to be sign extended to size_t.
2)
while (loff_t *pos < nr_cpu_ids)
MOVSXD is 1 byte longed than the same MOV.
Other cases exist as well. Basically compiler is told that nr_cpu_ids
can't be negative which can't be deduced if it is "int".
Code savings on allyesconfig kernel: -3KB
add/remove: 0/0 grow/shrink: 25/264 up/down: 261/-3631 (-3370)
function old new delta
coretemp_cpu_online 450 512 +62
rcu_init_one 1234 1272 +38
pci_device_probe 374 399 +25
...
pgdat_reclaimable_pages 628 556 -72
select_fallback_rq 446 369 -77
task_numa_find_cpu 1923 1807 -116
Link: http://lkml.kernel.org/r/20170819114959.GA30580@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2017-09-08 18:26:48 -07:00
Hans de Goede
594a30fb12
x86/apic: Silence "FW_BUG TSC_DEADLINE disabled due to Errata" on CPUs without the feature
...
When booting 4.13 on a VirtualBox VM on a Skylake host the following
error shows up in the logs:
[ 0.000000] [Firmware Bug]: TSC_DEADLINE disabled due to Errata;
please update microcode to version: 0xb2 (or later)
This is caused by apic_check_deadline_errata() only checking CPU model
and not the X86_FEATURE_TSC_DEADLINE_TIMER flag (which VirtualBox does
NOT export to the guest), combined with VirtualBox not exporting the
micro-code version to the guest.
This commit adds a check for X86_FEATURE_TSC_DEADLINE_TIMER to
apic_check_deadline_errata(), silencing this error on VirtualBox VMs.
Signed-off-by: Hans de Goede <hdegoede@redhat.com >
Acked-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Frank Mehnert <frank.mehnert@oracle.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Michael Thayer <michael.thayer@oracle.com >
Cc: Michal Necasek <michal.necasek@oracle.com >
Cc: Peter Zijlstra <peterz@infradead.org >
Fixes: bd9240a18e
("x86/apic: Add TSC_DEADLINE quirk due to errata")
Link: http://lkml.kernel.org/r/20170830105811.27539-1-hdegoede@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-08-31 11:17:27 +02:00
Thomas Gleixner
61069de7a3
x86/apic: Remove the duplicated tracing versions of interrupts
...
The error and the spurious interrupt are really rare events and not at all
performance sensitive: two NOP5s can be tolerated when tracing is disabled.
Remove the complication.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20170828064956.986009402@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-08-29 11:42:25 +02:00
Thomas Gleixner
3bec6def39
x86/apic: Use this_cpu_ptr() in local_timer_interrupt()
...
Accessing the per cpu data via per_cpu(, smp_processor_id()) is
pointless. Use this_cpu_ptr() instead.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/20170828064956.829552757@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-08-29 11:42:24 +02:00
Thomas Gleixner
302a98f896
x86/apic: Remove the duplicated tracing version of local_timer_interrupt()
...
The two NOP5s are noise in the rest of the work which is done by the timer
interrupt and modern CPUs are pretty good in optimizing NOPs anyway.
Get rid of the interrupt handler duplication and move the tracepoints into
the regular handler.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Link: http://lkml.kernel.org/r/20170828064956.751247330@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-08-29 11:42:24 +02:00
Thomas Gleixner
05161b9cbe
x86/irq: Get rid of the 'first_system_vector' indirection bogosity
...
This variable is beyond pointless. Nothing allocates a vector via
alloc_gate() below FIRST_SYSTEM_VECTOR. So nothing can change
first_system_vector.
If there is a need for a gate below FIRST_SYSTEM_VECTOR then it can be
added to the vector defines and FIRST_SYSTEM_VECTOR can be adjusted
accordingly.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Steven Rostedt <rostedt@goodmis.org >
Link: http://lkml.kernel.org/r/20170828064956.357109735@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-08-29 11:42:21 +02:00
raymond pang
adfaf18334
x86/ioapic: Print the IRTE's index field correctly when enabling INTR
...
When enabling interrupt remap, IOAPIC's RTE contains the interrupt_index
field of IRTE. This field is composed of the ->index and the ->index2 members
of 'struct IR_IO_APIC_route_entry' - but what we print out currently only
uses ->index.
Fix it.
Signed-off-by: Raymond Pang <raymondpangxd@gmail.com >
Cc: Linus Torvalds <torvalds@linux-foundation.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: joro@8bytes.org
Cc: linux-arch@vger.kernel.org
Link: http://lkml.kernel.org/r/CAHG4imNDzpDyOVi7MByVrLQ%3DQFuOVqpzJ5F-Xs5z6OZphubj-Q@mail.gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-08-23 10:17:17 +02:00
Seunghun Han
e708e35ba6
x86/ioapic: Pass the correct data to unmask_ioapic_irq()
...
One of the rarely executed code pathes in check_timer() calls
unmask_ioapic_irq() passing irq_get_chip_data(0) as argument.
That's wrong as unmask_ioapic_irq() expects a pointer to the irq data of
interrupt 0. irq_get_chip_data(0) returns NULL, so the following
dereference in unmask_ioapic_irq() causes a kernel panic.
The issue went unnoticed in the first place because irq_get_chip_data()
returns a void pointer so the compiler cannot do a type check on the
argument. The code path was added for machines with broken configuration,
but it seems that those machines are either not running current kernels or
simply do not longer exist.
Hand in irq_get_irq_data(0) as argument which provides the correct data.
[ tglx: Rewrote changelog ]
Fixes: 4467715a44
("x86/irq: Move irq_cfg.irq_2_pin into io_apic.c")
Signed-off-by: Seunghun Han <kkamagui@gmail.com >
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1500369644-45767-1-git-send-email-kkamagui@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org >
2017-07-20 10:28:10 +02:00
Nicholas Piggin
05a4a95279
kernel/watchdog: split up config options
...
Split SOFTLOCKUP_DETECTOR from LOCKUP_DETECTOR, and split
HARDLOCKUP_DETECTOR_PERF from HARDLOCKUP_DETECTOR.
LOCKUP_DETECTOR implies the general boot, sysctl, and programming
interfaces for the lockup detectors.
An architecture that wants to use a hard lockup detector must define
HAVE_HARDLOCKUP_DETECTOR_PERF or HAVE_HARDLOCKUP_DETECTOR_ARCH.
Alternatively an arch can define HAVE_NMI_WATCHDOG, which provides the
minimum arch_touch_nmi_watchdog, and it otherwise does its own thing and
does not implement the LOCKUP_DETECTOR interfaces.
sparc is unusual in that it has started to implement some of the
interfaces, but not fully yet. It should probably be converted to a full
HAVE_HARDLOCKUP_DETECTOR_ARCH.
[npiggin@gmail.com: fix]
Link: http://lkml.kernel.org/r/20170617223522.66c0ad88@roar.ozlabs.ibm.com
Link: http://lkml.kernel.org/r/20170616065715.18390-4-npiggin@gmail.com
Signed-off-by: Nicholas Piggin <npiggin@gmail.com >
Reviewed-by: Don Zickus <dzickus@redhat.com >
Reviewed-by: Babu Moger <babu.moger@oracle.com >
Tested-by: Babu Moger <babu.moger@oracle.com > [sparc]
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2017-07-12 16:26:02 -07:00