* [PATCH] x86/irq: use lapic_vector_set_in_irr to check for pending vectors in fixup_irqs.
@ 2024-05-06 11:16 Imran Khan
2024-05-06 17:38 ` Jacob Pan
0 siblings, 1 reply; 2+ messages in thread
From: Imran Khan @ 2024-05-06 11:16 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, hpa; +Cc: x86, linux-kernel
No functional change, just using readily available helper which
uses the same logic, that has been used here.
Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
---
arch/x86/kernel/irq.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 35fde0107901d..71432e42275c4 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -339,7 +339,7 @@ DEFINE_IDTENTRY_SYSVEC_SIMPLE(sysvec_kvm_posted_intr_nested_ipi)
/* A cpu has been removed from cpu_online_mask. Reset irq affinities. */
void fixup_irqs(void)
{
- unsigned int irr, vector;
+ unsigned int vector;
struct irq_desc *desc;
struct irq_data *data;
struct irq_chip *chip;
@@ -366,8 +366,7 @@ void fixup_irqs(void)
if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
continue;
- irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
- if (irr & (1 << (vector % 32))) {
+ if (lapic_vector_set_in_irr(vector)) {
desc = __this_cpu_read(vector_irq[vector]);
raw_spin_lock(&desc->lock);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/irq: use lapic_vector_set_in_irr to check for pending vectors in fixup_irqs.
2024-05-06 11:16 [PATCH] x86/irq: use lapic_vector_set_in_irr to check for pending vectors in fixup_irqs Imran Khan
@ 2024-05-06 17:38 ` Jacob Pan
0 siblings, 0 replies; 2+ messages in thread
From: Jacob Pan @ 2024-05-06 17:38 UTC (permalink / raw)
To: Imran Khan
Cc: tglx, mingo, bp, dave.hansen, hpa, x86, linux-kernel,
jacob.jun.pan
Hi Imran,
On Mon, 6 May 2024 21:16:34 +1000, Imran Khan <imran.f.khan@oracle.com>
wrote:
> No functional change, just using readily available helper which
> uses the same logic, that has been used here.
>
> Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
> ---
> arch/x86/kernel/irq.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index 35fde0107901d..71432e42275c4 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -339,7 +339,7 @@
> DEFINE_IDTENTRY_SYSVEC_SIMPLE(sysvec_kvm_posted_intr_nested_ipi) /* A cpu
> has been removed from cpu_online_mask. Reset irq affinities. */ void
> fixup_irqs(void) {
> - unsigned int irr, vector;
> + unsigned int vector;
> struct irq_desc *desc;
> struct irq_data *data;
> struct irq_chip *chip;
> @@ -366,8 +366,7 @@ void fixup_irqs(void)
> if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
> continue;
>
> - irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
> - if (irr & (1 << (vector % 32))) {
> + if (lapic_vector_set_in_irr(vector)) {
> desc = __this_cpu_read(vector_irq[vector]);
>
> raw_spin_lock(&desc->lock);
I have a similar refactoring as part of the posted MSI series, but I
totally missed the existing helper lapic_vector_set_in_irr().
https://lore.kernel.org/lkml/171448372145.10875.6906928487300074547.tip-bot2@tip-bot2/
Let me send out a fix patch against tip tree.
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -505,13 +505,7 @@ static inline bool lapic_vector_set_in_irr(unsigned int vector)
static inline bool is_vector_pending(unsigned int vector)
{
- unsigned int irr;
-
- irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
- if (irr & (1 << (vector % 32)))
- return true;
-
- return pi_pending_this_cpu(vector);
+ return lapic_vector_set_in_irr(vector) || pi_pending_this_cpu(vector);
}
Thanks,
Jacob
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-06 17:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 11:16 [PATCH] x86/irq: use lapic_vector_set_in_irr to check for pending vectors in fixup_irqs Imran Khan
2024-05-06 17:38 ` Jacob Pan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.