FAILED: patch "[PATCH] irqchip/mips-gic: Use raw spinlock for gic_lock" failed to apply to 4.14-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x 3d6a0e4197c04599d75d85a608c8bb16a630a38c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023052851-corridor-undead-9b30@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..
Possible dependencies:
3d6a0e4197c0 ("irqchip/mips-gic: Use raw spinlock for gic_lock") dd098a0e0319 ("irqchip/mips-gic: Get rid of the reliance on irq_cpu_online()") 6d4d367d0e9f ("irqchip/mips-gic: Use the correct local interrupt map registers") 25ac19e1b076 ("irqchip: mips-gic: Mask local interrupts when CPUs come online") da61fcf9d62a ("irqchip: mips-gic: Use irq_cpu_online to (un)mask all-VP(E) IRQs") 63b746b19fa6 ("irqchip: mips-gic: Inline gic_local_irq_domain_map()")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3d6a0e4197c04599d75d85a608c8bb16a630a38c Mon Sep 17 00:00:00 2001
From: Jiaxun Yang <[email protected]>
Date: Mon, 24 Apr 2023 11:31:56 +0100
Subject: [PATCH] irqchip/mips-gic: Use raw spinlock for gic_lock
Since we may hold gic_lock in hardirq context, use raw spinlock makes more sense given that it is for low-level interrupt handling routine and the critical section is small.
Fixes BUG:
[ 0.426106] =============================
[ 0.426257] [ BUG: Invalid wait context ]
[ 0.426422] 6.3.0-rc7-next-20230421-dirty #54 Not tainted
[ 0.426638] -----------------------------
[ 0.426766] swapper/0/1 is trying to lock:
[ 0.426954] ffffffff8104e7b8 (gic_lock){....}-{3:3}, at: gic_set_type+0x30/08drivers/irqchip/irq-mips-gic.c +15 -15
@@ -50,7 +50,7 @@ void __iomem *mips_gic_base; static DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX_LONGS], pcpu_masks); -static DEFINE_SPINLOCK (gic_lock); +static DEFINE_RAW_SPINLOCK (gic_lock);static struct irq_domain *gic_irq_domain;static int gic_shared_intrs;static unsigned int gic_cpu_pin;
@@ -210,7 +210,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type) irq =GIC_HWIRQ_TO_SHARED (d->hwirq); -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);switch (type &IRQ_TYPE_SENSE_MASK ) {case IRQ_TYPE_EDGE_FALLING : pol =GIC_POL_FALLING_EDGE ;
@@ -250,7 +250,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)else irq_set_chip_handler_name_locked (d, &gic_level_irq_controller, handle_level_irq,NULL ); -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags);return 0 ; }
@@ -268,7 +268,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,return -EINVAL ;/* Assumption : cpumask refers to a single CPU */ -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);/* Re-route this IRQ */ write_gic_map_vp (irq,BIT (mips_cm_vp_id (cpu)));
@@ -279,7 +279,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask,set_bit (irq,per_cpu_ptr (pcpu_masks, cpu));irq_data_update_effective_affinity (d,cpumask_of (cpu)); -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags);return IRQ_SET_MASK_OK ; }
@@ -357,12 +357,12 @@ static void gic_mask_local_irq_all_vpes(struct irq_data *d) cd =irq_data_get_irq_chip_data (d); cd->mask = false; -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);for_each_online_cpu (cpu) {write_gic_vl_other (mips_cm_vp_id (cpu));write_gic_vo_rmask (BIT (intr)); } -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags); }static void gic_unmask_local_irq_all_vpes (struct irq_data *d)
@@ -375,12 +375,12 @@ static void gic_unmask_local_irq_all_vpes(struct irq_data *d) cd =irq_data_get_irq_chip_data (d); cd->mask = true; -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);for_each_online_cpu (cpu) {write_gic_vl_other (mips_cm_vp_id (cpu));write_gic_vo_smask (BIT (intr)); } -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags); }static void gic_all_vpes_irq_cpu_online (void )
@@ -393,7 +393,7 @@ static void gic_all_vpes_irq_cpu_online(void)unsigned long flags;int i; -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);for (i =0 ; i <ARRAY_SIZE (local_intrs); i++) {unsigned int intr = local_intrs[i];
@@ -407,7 +407,7 @@ static void gic_all_vpes_irq_cpu_online(void)write_gic_vl_smask (BIT (intr)); } -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags); }static struct irq_chip gic_all_vpes_local_irq_controller = {
@@ -437,11 +437,11 @@ static int gic_shared_irq_domain_map(struct irq_domain *d, unsigned int virq, data =irq_get_irq_data (virq); -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);write_gic_map_pin (intr,GIC_MAP_PIN_MAP_TO_PIN | gic_cpu_pin);write_gic_map_vp (intr,BIT (mips_cm_vp_id (cpu)));irq_data_update_effective_affinity (data,cpumask_of (cpu)); -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags);return 0 ; }
@@ -533,12 +533,12 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int virq,if (!gic_local_irq_is_routable (intr))return -EPERM ; -spin_lock_irqsave (&gic_lock, flags); +raw_spin_lock_irqsave (&gic_lock, flags);for_each_online_cpu (cpu) {write_gic_vl_other (mips_cm_vp_id (cpu));write_gic_vo_map (mips_gic_vx_map_reg (intr), map); } -spin_unlock_irqrestore (&gic_lock, flags); +raw_spin_unlock_irqrestore (&gic_lock, flags);return 0 ; }