All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
@ 2022-02-11 18:14 Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 1/7] genirq: Provide generic_handle_irq_safe() Sebastian Andrzej Siewior
                   ` (7 more replies)
  0 siblings, 8 replies; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

handler/ interrupt controller entry). It is low level code and the
function expects that interrupts are disabled at entry point.

This isn't the case for invocations from tasklets, workqueues or the
primary interrupt handler on PREEMPT_RT. Once this gets noticed a
"local_irq_disable|safe()" is added. To avoid further confusion this
series adds generic_handle_irq_safe() which can be used from any context
and adds a few user.

v2…v4:
  - Correct kernel doc for generic_handle_irq_safe() as per Wolfram Sang.
  - Use "misc" instead of "mfd" for the hi6421-spmi-pmic driver.

v2…v1:
 https://lore.kernel.org/all/20220131123404.175438-1-bigeasy@linutronix.de/
 - Redo kernel-doc for generic_handle_irq_safe() in #1.
 - Use generic_handle_irq_safe() instead of generic_handle_irq() in the
   patch description where I accidently used the wrong one.
v1:
 https://lore.kernel.org/all/20220127113303.3012207-1-bigeasy@linutronix.de/



^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v4 1/7] genirq: Provide generic_handle_irq_safe().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
@ 2022-02-11 18:14 ` Sebastian Andrzej Siewior
  2022-02-21 11:19   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify() Sebastian Andrzej Siewior
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior, Oleksandr Natalenko,
	Wolfram Sang

Provide generic_handle_irq_safe() which can used from any context.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 include/linux/irqdesc.h |  1 +
 kernel/irq/irqdesc.c    | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 93d270ca0c567..a77584593f7d1 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -160,6 +160,7 @@ static inline void generic_handle_irq_desc(struct irq_desc *desc)
 
 int handle_irq_desc(struct irq_desc *desc);
 int generic_handle_irq(unsigned int irq);
+int generic_handle_irq_safe(unsigned int irq);
 
 #ifdef CONFIG_IRQ_DOMAIN
 /*
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 2267e6527db3c..346d283d2da14 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -662,6 +662,29 @@ int generic_handle_irq(unsigned int irq)
 }
 EXPORT_SYMBOL_GPL(generic_handle_irq);
 
+/**
+ * generic_handle_irq_safe - Invoke the handler for a particular irq from any
+ *			     context.
+ * @irq:	The irq number to handle
+ *
+ * Returns:	0 on success, a negative value on error.
+ *
+ * This function can be called from any context (IRQ or process context). It
+ * will report an error if not invoked from IRQ context and the irq has been
+ * marked to enforce IRQ-context only.
+ */
+int generic_handle_irq_safe(unsigned int irq)
+{
+	unsigned long flags;
+	int ret;
+
+	local_irq_save(flags);
+	ret = handle_irq_desc(irq_to_desc(irq));
+	local_irq_restore(flags);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(generic_handle_irq_safe);
+
 #ifdef CONFIG_IRQ_DOMAIN
 /**
  * generic_handle_domain_irq - Invoke the handler for a HW irq belonging
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 1/7] genirq: Provide generic_handle_irq_safe() Sebastian Andrzej Siewior
@ 2022-02-11 18:14 ` Sebastian Andrzej Siewior
  2022-02-23 13:21   ` Wolfram Sang
  2022-02-11 18:14 ` [PATCH v4 3/7] i2c: cht-wc: Use generic_handle_irq_safe() Sebastian Andrzej Siewior
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior, Michael Below,
	Salvatore Bonaccorso, Oleksandr Natalenko

The i2c-i801 driver invokes i2c_handle_smbus_host_notify() from his
interrupt service routine. On PREEMPT_RT i2c-i801's handler is forced
threaded with enabled interrupts which leads to a warning by
handle_irq_event_percpu() assuming that irq_default_primary_handler()
enabled interrupts.

i2c-i801's interrupt handler can't be made non-threaded because the
interrupt line is shared with other devices.

Use generic_handle_irq_safe() which can invoked with disabled and enabled
interrupts.

Reported-by: Michael Below <below@judiz.de>
Link: https://bugs.debian.org/1002537
Cc: Salvatore Bonaccorso <carnil@debian.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Acked-by: Wolfram Sang <wsa@kernel.org>
---
 drivers/i2c/i2c-core-base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 2c59dd748a49f..3f9e5303b6163 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1424,7 +1424,7 @@ int i2c_handle_smbus_host_notify(struct i2c_adapter *adap, unsigned short addr)
 	if (irq <= 0)
 		return -ENXIO;
 
-	generic_handle_irq(irq);
+	generic_handle_irq_safe(irq);
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 3/7] i2c: cht-wc: Use generic_handle_irq_safe().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 1/7] genirq: Provide generic_handle_irq_safe() Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify() Sebastian Andrzej Siewior
@ 2022-02-11 18:14 ` Sebastian Andrzej Siewior
  2022-02-23 13:21   ` Wolfram Sang
  2022-02-11 18:14 ` [PATCH v4 4/7] misc: hi6421-spmi-pmic: " Sebastian Andrzej Siewior
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Wolfram Sang <wsa@kernel.org>
---
 drivers/i2c/busses/i2c-cht-wc.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
index 1cf68f85b2e11..8ccf0c928bb44 100644
--- a/drivers/i2c/busses/i2c-cht-wc.c
+++ b/drivers/i2c/busses/i2c-cht-wc.c
@@ -99,15 +99,8 @@ static irqreturn_t cht_wc_i2c_adap_thread_handler(int id, void *data)
 	 * interrupt handler as well, so running the client irq handler from
 	 * this thread will cause things to lock up.
 	 */
-	if (reg & CHT_WC_EXTCHGRIRQ_CLIENT_IRQ) {
-		/*
-		 * generic_handle_irq expects local IRQs to be disabled
-		 * as normally it is called from interrupt context.
-		 */
-		local_irq_disable();
-		generic_handle_irq(adap->client_irq);
-		local_irq_enable();
-	}
+	if (reg & CHT_WC_EXTCHGRIRQ_CLIENT_IRQ)
+		generic_handle_irq_safe(adap->client_irq);
 
 	return IRQ_HANDLED;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 4/7] misc: hi6421-spmi-pmic: Use generic_handle_irq_safe().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
                   ` (2 preceding siblings ...)
  2022-02-11 18:14 ` [PATCH v4 3/7] i2c: cht-wc: Use generic_handle_irq_safe() Sebastian Andrzej Siewior
@ 2022-02-11 18:14 ` Sebastian Andrzej Siewior
  2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 5/7] mfd: ezx-pcap: " Sebastian Andrzej Siewior
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior

generic_handle_irq() is invoked from a regular interrupt service
routine. This handler will become a forced-threaded handler on
PREEMPT_RT and will be invoked with enabled interrupts. The
generic_handle_irq() must be invoked with disabled interrupts in order
to avoid deadlocks.

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/misc/hi6421v600-irq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/hi6421v600-irq.c b/drivers/misc/hi6421v600-irq.c
index 1c763796cf1fa..caa3de37698b0 100644
--- a/drivers/misc/hi6421v600-irq.c
+++ b/drivers/misc/hi6421v600-irq.c
@@ -117,8 +117,8 @@ static irqreturn_t hi6421v600_irq_handler(int irq, void *__priv)
 			 * If both powerkey down and up IRQs are received,
 			 * handle them at the right order
 			 */
-			generic_handle_irq(priv->irqs[POWERKEY_DOWN]);
-			generic_handle_irq(priv->irqs[POWERKEY_UP]);
+			generic_handle_irq_safe(priv->irqs[POWERKEY_DOWN]);
+			generic_handle_irq_safe(priv->irqs[POWERKEY_UP]);
 			pending &= ~HISI_IRQ_POWERKEY_UP_DOWN;
 		}
 
@@ -126,7 +126,7 @@ static irqreturn_t hi6421v600_irq_handler(int irq, void *__priv)
 			continue;
 
 		for_each_set_bit(offset, &pending, BITS_PER_BYTE) {
-			generic_handle_irq(priv->irqs[offset + i * BITS_PER_BYTE]);
+			generic_handle_irq_safe(priv->irqs[offset + i * BITS_PER_BYTE]);
 		}
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 5/7] mfd: ezx-pcap: Use generic_handle_irq_safe().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
                   ` (3 preceding siblings ...)
  2022-02-11 18:14 ` [PATCH v4 4/7] misc: hi6421-spmi-pmic: " Sebastian Andrzej Siewior
@ 2022-02-11 18:14 ` Sebastian Andrzej Siewior
  2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
  2022-02-11 18:14 ` [PATCH v4 6/7] net: usb: lan78xx: " Sebastian Andrzej Siewior
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/mfd/ezx-pcap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 70fa18b04ad2b..b14d3f98e1ebd 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -193,13 +193,11 @@ static void pcap_isr_work(struct work_struct *work)
 		ezx_pcap_write(pcap, PCAP_REG_MSR, isr | msr);
 		ezx_pcap_write(pcap, PCAP_REG_ISR, isr);
 
-		local_irq_disable();
 		service = isr & ~msr;
 		for (irq = pcap->irq_base; service; service >>= 1, irq++) {
 			if (service & 1)
-				generic_handle_irq(irq);
+				generic_handle_irq_safe(irq);
 		}
-		local_irq_enable();
 		ezx_pcap_write(pcap, PCAP_REG_MSR, pcap->msr);
 	} while (gpio_get_value(pdata->gpio));
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 6/7] net: usb: lan78xx: Use generic_handle_irq_safe().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
                   ` (4 preceding siblings ...)
  2022-02-11 18:14 ` [PATCH v4 5/7] mfd: ezx-pcap: " Sebastian Andrzej Siewior
@ 2022-02-11 18:14 ` Sebastian Andrzej Siewior
  2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
  2022-02-11 18:15 ` [PATCH v4 7/7] staging: greybus: gpio: " Sebastian Andrzej Siewior
  2022-02-15 14:36 ` [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Lee Jones
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:14 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 drivers/net/usb/lan78xx.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index b8e20a3f2b84e..415f16662f88e 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1537,11 +1537,8 @@ static void lan78xx_status(struct lan78xx_net *dev, struct urb *urb)
 		netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata);
 		lan78xx_defer_kevent(dev, EVENT_LINK_RESET);
 
-		if (dev->domain_data.phyirq > 0) {
-			local_irq_disable();
-			generic_handle_irq(dev->domain_data.phyirq);
-			local_irq_enable();
-		}
+		if (dev->domain_data.phyirq > 0)
+			generic_handle_irq_safe(dev->domain_data.phyirq);
 	} else {
 		netdev_warn(dev->net,
 			    "unexpected interrupt: 0x%08x\n", intdata);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v4 7/7] staging: greybus: gpio: Use generic_handle_irq_safe().
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
                   ` (5 preceding siblings ...)
  2022-02-11 18:14 ` [PATCH v4 6/7] net: usb: lan78xx: " Sebastian Andrzej Siewior
@ 2022-02-11 18:15 ` Sebastian Andrzej Siewior
  2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
  2022-02-15 14:36 ` [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Lee Jones
  7 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-11 18:15 UTC (permalink / raw)
  To: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb, netdev
  Cc: David S. Miller, Alex Elder, Arnd Bergmann, Greg Kroah-Hartman,
	Hans de Goede, Jakub Kicinski, Johan Hovold, Lee Jones,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh, Sebastian Andrzej Siewior

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Johan Hovold <johan@kernel.org>
---
 drivers/staging/greybus/gpio.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index 7e6347fe93f99..8a7cf1d0e9688 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -391,10 +391,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
 		return -EINVAL;
 	}
 
-	local_irq_disable();
-	ret = generic_handle_irq(irq);
-	local_irq_enable();
-
+	ret = generic_handle_irq_safe(irq);
 	if (ret)
 		dev_err(dev, "failed to invoke irq handler\n");
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
                   ` (6 preceding siblings ...)
  2022-02-11 18:15 ` [PATCH v4 7/7] staging: greybus: gpio: " Sebastian Andrzej Siewior
@ 2022-02-15 14:36 ` Lee Jones
  2022-02-15 14:50   ` Sebastian Andrzej Siewior
  7 siblings, 1 reply; 27+ messages in thread
From: Lee Jones @ 2022-02-15 14:36 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On Fri, 11 Feb 2022, Sebastian Andrzej Siewior wrote:

> handler/ interrupt controller entry). It is low level code and the
> function expects that interrupts are disabled at entry point.
> 
> This isn't the case for invocations from tasklets, workqueues or the
> primary interrupt handler on PREEMPT_RT. Once this gets noticed a
> "local_irq_disable|safe()" is added. To avoid further confusion this
> series adds generic_handle_irq_safe() which can be used from any context
> and adds a few user.
> 
> v2…v4:
>   - Correct kernel doc for generic_handle_irq_safe() as per Wolfram Sang.
>   - Use "misc" instead of "mfd" for the hi6421-spmi-pmic driver.
> 
> v2…v1:
>  https://lore.kernel.org/all/20220131123404.175438-1-bigeasy@linutronix.de/
>  - Redo kernel-doc for generic_handle_irq_safe() in #1.
>  - Use generic_handle_irq_safe() instead of generic_handle_irq() in the
>    patch description where I accidently used the wrong one.
> v1:
>  https://lore.kernel.org/all/20220127113303.3012207-1-bigeasy@linutronix.de/

Please use the official cover-letter format (--cover-letter).

It would have been nice to at least find a diff stat here.

...

Do we really need to coordinate this series cross-subsystem?

Can we first apply the API, then have each of the subsystems adapted
separately?  Does the change-over all need to happen concurrently?

If the latter is the case, is this set bisectable?

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-15 14:36 ` [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Lee Jones
@ 2022-02-15 14:50   ` Sebastian Andrzej Siewior
  2022-02-15 15:16     ` Lee Jones
  0 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-15 14:50 UTC (permalink / raw)
  To: Lee Jones
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On 2022-02-15 14:36:01 [+0000], Lee Jones wrote:
> Do we really need to coordinate this series cross-subsystem?

I would suggest to merge it via irq subsystem but I leave the logistics
to tglx.

Sebastian

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-15 14:50   ` Sebastian Andrzej Siewior
@ 2022-02-15 15:16     ` Lee Jones
  2022-02-15 15:33       ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 27+ messages in thread
From: Lee Jones @ 2022-02-15 15:16 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On Tue, 15 Feb 2022, Sebastian Andrzej Siewior wrote:

> On 2022-02-15 14:36:01 [+0000], Lee Jones wrote:
> > Do we really need to coordinate this series cross-subsystem?
> 
> I would suggest to merge it via irq subsystem but I leave the logistics
> to tglx.

Could you answer by other questions too please?

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-15 15:16     ` Lee Jones
@ 2022-02-15 15:33       ` Sebastian Andrzej Siewior
  2022-02-15 15:42         ` Lee Jones
  0 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-15 15:33 UTC (permalink / raw)
  To: Lee Jones
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On 2022-02-15 15:16:36 [+0000], Lee Jones wrote:
> On Tue, 15 Feb 2022, Sebastian Andrzej Siewior wrote:
> 
> > On 2022-02-15 14:36:01 [+0000], Lee Jones wrote:
> > > Do we really need to coordinate this series cross-subsystem?
> > 
> > I would suggest to merge it via irq subsystem but I leave the logistics
> > to tglx.
> 
> Could you answer by other questions too please?

I don't think that I can answer them. I said I leave the logistics to
tglx.

This can go via one merge via irq. This can also go differently i.e.
feature branch on top of 5.17-rc1 (with 1/7) which is merge into each
subsystem and then the "feature" on top.

Either way it remains bisect-able since each driver is changed
individually. There is no need to merge them in one go but since it is
that small it probably makes sense. But I don't do the logistics here.

Sebastian

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-15 15:33       ` Sebastian Andrzej Siewior
@ 2022-02-15 15:42         ` Lee Jones
  2022-02-15 15:46           ` Sebastian Andrzej Siewior
  2022-02-21  9:57           ` Thomas Gleixner
  0 siblings, 2 replies; 27+ messages in thread
From: Lee Jones @ 2022-02-15 15:42 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On Tue, 15 Feb 2022, Sebastian Andrzej Siewior wrote:

> On 2022-02-15 15:16:36 [+0000], Lee Jones wrote:
> > On Tue, 15 Feb 2022, Sebastian Andrzej Siewior wrote:
> > 
> > > On 2022-02-15 14:36:01 [+0000], Lee Jones wrote:
> > > > Do we really need to coordinate this series cross-subsystem?
> > > 
> > > I would suggest to merge it via irq subsystem but I leave the logistics
> > > to tglx.
> > 
> > Could you answer by other questions too please?
> 
> I don't think that I can answer them. I said I leave the logistics to
> tglx.
> 
> This can go via one merge via irq. This can also go differently i.e.
> feature branch on top of 5.17-rc1 (with 1/7) which is merge into each
> subsystem and then the "feature" on top.

Apologies for the confusion.

I'm not asking you about merge strategies.

We can handle that without issue.

> Either way it remains bisect-able since each driver is changed
> individually. There is no need to merge them in one go but since it is
> that small it probably makes sense. But I don't do the logistics here.

Okay, this is what I was asking.

So there aren't any hard dependencies between the driver changes?

Only the drivers are dependent on the API.

So, if we choose to do so, we can merge the API and then subsequently
add the users one by one into their respective subsystem, in any
order.  This would save on creating an immutable topic branch which we
all pull from.

What is your preference Thomas?

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-15 15:42         ` Lee Jones
@ 2022-02-15 15:46           ` Sebastian Andrzej Siewior
  2022-02-21  9:57           ` Thomas Gleixner
  1 sibling, 0 replies; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-15 15:46 UTC (permalink / raw)
  To: Lee Jones
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On 2022-02-15 15:42:13 [+0000], Lee Jones wrote:
> So there aren't any hard dependencies between the driver changes?

Correct. #2 - #7 depend on #1. The order of #2+ is not relevant.

Sebastian

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-15 15:42         ` Lee Jones
  2022-02-15 15:46           ` Sebastian Andrzej Siewior
@ 2022-02-21  9:57           ` Thomas Gleixner
  2022-02-21 11:33             ` Thomas Gleixner
  1 sibling, 1 reply; 27+ messages in thread
From: Thomas Gleixner @ 2022-02-21  9:57 UTC (permalink / raw)
  To: Lee Jones, Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, UNGLinuxDriver, Wolfram Sang, Woojung Huh

Lee,

On Tue, Feb 15 2022 at 15:42, Lee Jones wrote:
> On Tue, 15 Feb 2022, Sebastian Andrzej Siewior wrote:
>> Either way it remains bisect-able since each driver is changed
>> individually. There is no need to merge them in one go but since it is
>> that small it probably makes sense. But I don't do the logistics here.
>
> Okay, this is what I was asking.
>
> So there aren't any hard dependencies between the driver changes?
>
> Only the drivers are dependent on the API.

Correct.

> So, if we choose to do so, we can merge the API and then subsequently
> add the users one by one into their respective subsystem, in any
> order.  This would save on creating an immutable topic branch which we
> all pull from.
>
> What is your preference Thomas?

I suggest doing it the following way:

 1) I apply 1/7 on top of -rc5 and tag it

 2) Driver maintainers who want to merge via their trees pull that tag
    apply the relevant driver changes

 3) I collect the leftovers and merge them via irq/core

Does that make sense?

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [tip: irq/core] genirq: Provide generic_handle_irq_safe()
  2022-02-11 18:14 ` [PATCH v4 1/7] genirq: Provide generic_handle_irq_safe() Sebastian Andrzej Siewior
@ 2022-02-21 11:19   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 27+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2022-02-21 11:19 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Thomas Gleixner, Sebastian Andrzej Siewior, Hans de Goede,
	Oleksandr Natalenko, Wolfram Sang, x86, linux-kernel, maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     509853f9e1e7b1490dc79f735a5dbafc9298f40d
Gitweb:        https://git.kernel.org/tip/509853f9e1e7b1490dc79f735a5dbafc9298f40d
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Fri, 11 Feb 2022 19:14:54 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 21 Feb 2022 11:31:06 +01:00

genirq: Provide generic_handle_irq_safe()

Provide generic_handle_irq_safe() which can used from any context.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220211181500.1856198-2-bigeasy@linutronix.de
---
 include/linux/irqdesc.h |  1 +
 kernel/irq/irqdesc.c    | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 93d270c..a775845 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -160,6 +160,7 @@ static inline void generic_handle_irq_desc(struct irq_desc *desc)
 
 int handle_irq_desc(struct irq_desc *desc);
 int generic_handle_irq(unsigned int irq);
+int generic_handle_irq_safe(unsigned int irq);
 
 #ifdef CONFIG_IRQ_DOMAIN
 /*
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 2267e65..346d283 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -662,6 +662,29 @@ int generic_handle_irq(unsigned int irq)
 }
 EXPORT_SYMBOL_GPL(generic_handle_irq);
 
+/**
+ * generic_handle_irq_safe - Invoke the handler for a particular irq from any
+ *			     context.
+ * @irq:	The irq number to handle
+ *
+ * Returns:	0 on success, a negative value on error.
+ *
+ * This function can be called from any context (IRQ or process context). It
+ * will report an error if not invoked from IRQ context and the irq has been
+ * marked to enforce IRQ-context only.
+ */
+int generic_handle_irq_safe(unsigned int irq)
+{
+	unsigned long flags;
+	int ret;
+
+	local_irq_save(flags);
+	ret = handle_irq_desc(irq_to_desc(irq));
+	local_irq_restore(flags);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(generic_handle_irq_safe);
+
 #ifdef CONFIG_IRQ_DOMAIN
 /**
  * generic_handle_domain_irq - Invoke the handler for a HW irq belonging

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-21  9:57           ` Thomas Gleixner
@ 2022-02-21 11:33             ` Thomas Gleixner
  2022-02-21 12:38               ` Lee Jones
  2022-02-23 13:19               ` Wolfram Sang
  0 siblings, 2 replies; 27+ messages in thread
From: Thomas Gleixner @ 2022-02-21 11:33 UTC (permalink / raw)
  To: Lee Jones, Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Rui Miguel Silva, UNGLinuxDriver, Wolfram Sang, Woojung Huh

Lee & al!

On Mon, Feb 21 2022 at 10:57, Thomas Gleixner wrote:
> On Tue, Feb 15 2022 at 15:42, Lee Jones wrote:
>> What is your preference Thomas?
>
> I suggest doing it the following way:
>
>  1) I apply 1/7 on top of -rc5 and tag it

That's what I did now. The tag to pull from is:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-api-2022-02-21

>  2) Driver maintainers who want to merge via their trees pull that tag
>     apply the relevant driver changes
>
>  3) I collect the leftovers and merge them via irq/core

So everyone who wants to merge the relevant driver changes, please pull
and let me know which driver patch(es) you merged. I'll pick up the
leftovers after -rc6.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-21 11:33             ` Thomas Gleixner
@ 2022-02-21 12:38               ` Lee Jones
  2022-02-23 13:19               ` Wolfram Sang
  1 sibling, 0 replies; 27+ messages in thread
From: Lee Jones @ 2022-02-21 12:38 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Sebastian Andrzej Siewior, greybus-dev, linux-i2c, linux-kernel,
	linux-staging, linux-usb, netdev, David S. Miller, Alex Elder,
	Arnd Bergmann, Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski,
	Johan Hovold, Rui Miguel Silva, UNGLinuxDriver, Wolfram Sang,
	Woojung Huh

On Mon, 21 Feb 2022, Thomas Gleixner wrote:

> Lee & al!
> 
> On Mon, Feb 21 2022 at 10:57, Thomas Gleixner wrote:
> > On Tue, Feb 15 2022 at 15:42, Lee Jones wrote:
> >> What is your preference Thomas?
> >
> > I suggest doing it the following way:
> >
> >  1) I apply 1/7 on top of -rc5 and tag it
> 
> That's what I did now. The tag to pull from is:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-api-2022-02-21
> 
> >  2) Driver maintainers who want to merge via their trees pull that tag
> >     apply the relevant driver changes
> >
> >  3) I collect the leftovers and merge them via irq/core
> 
> So everyone who wants to merge the relevant driver changes, please pull
> and let me know which driver patch(es) you merged. I'll pick up the
> leftovers after -rc6.

Ideal.  Thanks Thomas.

-- 
Lee Jones [李琼斯]
Principal Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate.
  2022-02-21 11:33             ` Thomas Gleixner
  2022-02-21 12:38               ` Lee Jones
@ 2022-02-23 13:19               ` Wolfram Sang
  1 sibling, 0 replies; 27+ messages in thread
From: Wolfram Sang @ 2022-02-23 13:19 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Lee Jones, Sebastian Andrzej Siewior, greybus-dev, linux-i2c,
	linux-kernel, linux-staging, linux-usb, netdev, David S. Miller,
	Alex Elder, Arnd Bergmann, Greg Kroah-Hartman, Hans de Goede,
	Jakub Kicinski, Johan Hovold, Rui Miguel Silva, UNGLinuxDriver,
	Woojung Huh

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]


> That's what I did now. The tag to pull from is:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-api-2022-02-21

Thanks! Pulled into i2c/for-mergewindow.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify().
  2022-02-11 18:14 ` [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify() Sebastian Andrzej Siewior
@ 2022-02-23 13:21   ` Wolfram Sang
  2022-02-25 22:26     ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 27+ messages in thread
From: Wolfram Sang @ 2022-02-23 13:21 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Lee Jones, Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver,
	Woojung Huh, Michael Below, Salvatore Bonaccorso,
	Oleksandr Natalenko

[-- Attachment #1: Type: text/plain, Size: 963 bytes --]

On Fri, Feb 11, 2022 at 07:14:55PM +0100, Sebastian Andrzej Siewior wrote:
> The i2c-i801 driver invokes i2c_handle_smbus_host_notify() from his
> interrupt service routine. On PREEMPT_RT i2c-i801's handler is forced
> threaded with enabled interrupts which leads to a warning by
> handle_irq_event_percpu() assuming that irq_default_primary_handler()
> enabled interrupts.
> 
> i2c-i801's interrupt handler can't be made non-threaded because the
> interrupt line is shared with other devices.
> 
> Use generic_handle_irq_safe() which can invoked with disabled and enabled
> interrupts.
> 
> Reported-by: Michael Below <below@judiz.de>
> Link: https://bugs.debian.org/1002537
> Cc: Salvatore Bonaccorso <carnil@debian.org>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Reviewed-by: Oleksandr Natalenko <oleksandr@natalenko.name>
> Acked-by: Wolfram Sang <wsa@kernel.org>

Is this 5.17 material? Or is 5.18 fine, too?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 3/7] i2c: cht-wc: Use generic_handle_irq_safe().
  2022-02-11 18:14 ` [PATCH v4 3/7] i2c: cht-wc: Use generic_handle_irq_safe() Sebastian Andrzej Siewior
@ 2022-02-23 13:21   ` Wolfram Sang
  0 siblings, 0 replies; 27+ messages in thread
From: Wolfram Sang @ 2022-02-23 13:21 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Lee Jones, Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver,
	Woojung Huh

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

On Fri, Feb 11, 2022 at 07:14:56PM +0100, Sebastian Andrzej Siewior wrote:
> Instead of manually disabling interrupts before invoking use
> generic_handle_irq_safe() which can be invoked with enabled and disabled
> interrupts.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Acked-by: Wolfram Sang <wsa@kernel.org>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify().
  2022-02-23 13:21   ` Wolfram Sang
@ 2022-02-25 22:26     ` Sebastian Andrzej Siewior
  2022-03-01 15:06       ` Wolfram Sang
  0 siblings, 1 reply; 27+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-02-25 22:26 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Lee Jones, Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver,
	Woojung Huh, Michael Below, Salvatore Bonaccorso,
	Oleksandr Natalenko

On 2022-02-23 14:21:32 [+0100], Wolfram Sang wrote:
> Is this 5.17 material? Or is 5.18 fine, too?

5.18 is fine. I intend to push into the RT-stable trees and this can't
be backported without 1/7 and it does not affect !RT so I wouldn't
bother.

Sebastian

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify().
  2022-02-25 22:26     ` Sebastian Andrzej Siewior
@ 2022-03-01 15:06       ` Wolfram Sang
  0 siblings, 0 replies; 27+ messages in thread
From: Wolfram Sang @ 2022-03-01 15:06 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: greybus-dev, linux-i2c, linux-kernel, linux-staging, linux-usb,
	netdev, David S. Miller, Alex Elder, Arnd Bergmann,
	Greg Kroah-Hartman, Hans de Goede, Jakub Kicinski, Johan Hovold,
	Lee Jones, Rui Miguel Silva, Thomas Gleixner, UNGLinuxDriver,
	Woojung Huh, Michael Below, Salvatore Bonaccorso,
	Oleksandr Natalenko

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

On Fri, Feb 25, 2022 at 11:26:46PM +0100, Sebastian Andrzej Siewior wrote:
> On 2022-02-23 14:21:32 [+0100], Wolfram Sang wrote:
> > Is this 5.17 material? Or is 5.18 fine, too?
> 
> 5.18 is fine. I intend to push into the RT-stable trees and this can't
> be backported without 1/7 and it does not affect !RT so I wouldn't
> bother.

Ok, applied to for-next then. Thanks for the heads up!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [tip: irq/core] staging: greybus: gpio: Use generic_handle_irq_safe().
  2022-02-11 18:15 ` [PATCH v4 7/7] staging: greybus: gpio: " Sebastian Andrzej Siewior
@ 2022-03-02 21:35   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 27+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2022-03-02 21:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Greg Kroah-Hartman,
	Johan Hovold, Alex Elder, Rui Miguel Silva, x86, linux-kernel,
	maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     ff8dcfebe08dfb2524041116d4afce53ffe0b015
Gitweb:        https://git.kernel.org/tip/ff8dcfebe08dfb2524041116d4afce53ffe0b015
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Fri, 11 Feb 2022 19:15:00 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Mar 2022 22:28:51 +01:00

staging: greybus: gpio: Use generic_handle_irq_safe().

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Rui Miguel Silva <rmfrfs@gmail.com>
Link: https://lore.kernel.org/r/20220211181500.1856198-8-bigeasy@linutronix.de

---
 drivers/staging/greybus/gpio.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index 7e6347f..8a7cf1d 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -391,10 +391,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
 		return -EINVAL;
 	}
 
-	local_irq_disable();
-	ret = generic_handle_irq(irq);
-	local_irq_enable();
-
+	ret = generic_handle_irq_safe(irq);
 	if (ret)
 		dev_err(dev, "failed to invoke irq handler\n");
 

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [tip: irq/core] net: usb: lan78xx: Use generic_handle_irq_safe().
  2022-02-11 18:14 ` [PATCH v4 6/7] net: usb: lan78xx: " Sebastian Andrzej Siewior
@ 2022-03-02 21:35   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 27+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2022-03-02 21:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Woojung Huh,
	David S. Miller, Jakub Kicinski, UNGLinuxDriver, x86,
	linux-kernel, maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     bfe6b967948c251955bcf175cb2d4e8d169102ca
Gitweb:        https://git.kernel.org/tip/bfe6b967948c251955bcf175cb2d4e8d169102ca
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Fri, 11 Feb 2022 19:14:59 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Mar 2022 22:28:50 +01:00

net: usb: lan78xx: Use generic_handle_irq_safe().

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Woojung Huh <woojung.huh@microchip.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: UNGLinuxDriver@microchip.com
Link: https://lore.kernel.org/r/20220211181500.1856198-7-bigeasy@linutronix.de

---
 drivers/net/usb/lan78xx.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index b8e20a3..415f166 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1537,11 +1537,8 @@ static void lan78xx_status(struct lan78xx_net *dev, struct urb *urb)
 		netif_dbg(dev, link, dev->net, "PHY INTR: 0x%08x\n", intdata);
 		lan78xx_defer_kevent(dev, EVENT_LINK_RESET);
 
-		if (dev->domain_data.phyirq > 0) {
-			local_irq_disable();
-			generic_handle_irq(dev->domain_data.phyirq);
-			local_irq_enable();
-		}
+		if (dev->domain_data.phyirq > 0)
+			generic_handle_irq_safe(dev->domain_data.phyirq);
 	} else {
 		netdev_warn(dev->net,
 			    "unexpected interrupt: 0x%08x\n", intdata);

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [tip: irq/core] mfd: ezx-pcap: Use generic_handle_irq_safe().
  2022-02-11 18:14 ` [PATCH v4 5/7] mfd: ezx-pcap: " Sebastian Andrzej Siewior
@ 2022-03-02 21:35   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 27+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2022-03-02 21:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner, Lee Jones, x86,
	linux-kernel, maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     83d9b7e3955d32d3e4e3321029f655716cb21c99
Gitweb:        https://git.kernel.org/tip/83d9b7e3955d32d3e4e3321029f655716cb21c99
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Fri, 11 Feb 2022 19:14:58 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Mar 2022 22:28:50 +01:00

mfd: ezx-pcap: Use generic_handle_irq_safe().

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220211181500.1856198-6-bigeasy@linutronix.de

---
 drivers/mfd/ezx-pcap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 70fa18b..b14d3f9 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -193,13 +193,11 @@ static void pcap_isr_work(struct work_struct *work)
 		ezx_pcap_write(pcap, PCAP_REG_MSR, isr | msr);
 		ezx_pcap_write(pcap, PCAP_REG_ISR, isr);
 
-		local_irq_disable();
 		service = isr & ~msr;
 		for (irq = pcap->irq_base; service; service >>= 1, irq++) {
 			if (service & 1)
-				generic_handle_irq(irq);
+				generic_handle_irq_safe(irq);
 		}
-		local_irq_enable();
 		ezx_pcap_write(pcap, PCAP_REG_MSR, pcap->msr);
 	} while (gpio_get_value(pdata->gpio));
 }

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [tip: irq/core] misc: hi6421-spmi-pmic: Use generic_handle_irq_safe().
  2022-02-11 18:14 ` [PATCH v4 4/7] misc: hi6421-spmi-pmic: " Sebastian Andrzej Siewior
@ 2022-03-02 21:35   ` tip-bot2 for Sebastian Andrzej Siewior
  0 siblings, 0 replies; 27+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2022-03-02 21:35 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Sebastian Andrzej Siewior, Thomas Gleixner,
	Mauro Carvalho Chehab, Arnd Bergmann, Greg Kroah-Hartman, x86,
	linux-kernel, maz

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     1b9855de1ef4a3f82119f9d8b054a588c7c315fb
Gitweb:        https://git.kernel.org/tip/1b9855de1ef4a3f82119f9d8b054a588c7c315fb
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Fri, 11 Feb 2022 19:14:57 +01:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 02 Mar 2022 22:28:50 +01:00

misc: hi6421-spmi-pmic: Use generic_handle_irq_safe().

generic_handle_irq() is invoked from a regular interrupt service
routine. This handler will become a forced-threaded handler on
PREEMPT_RT and will be invoked with enabled interrupts. The
generic_handle_irq() must be invoked with disabled interrupts in order
to avoid deadlocks.

Instead of manually disabling interrupts before invoking use
generic_handle_irq_safe() which can be invoked with enabled and disabled
interrupts.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org> 
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20220211181500.1856198-5-bigeasy@linutronix.de

---
 drivers/misc/hi6421v600-irq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/hi6421v600-irq.c b/drivers/misc/hi6421v600-irq.c
index 1c76379..caa3de3 100644
--- a/drivers/misc/hi6421v600-irq.c
+++ b/drivers/misc/hi6421v600-irq.c
@@ -117,8 +117,8 @@ static irqreturn_t hi6421v600_irq_handler(int irq, void *__priv)
 			 * If both powerkey down and up IRQs are received,
 			 * handle them at the right order
 			 */
-			generic_handle_irq(priv->irqs[POWERKEY_DOWN]);
-			generic_handle_irq(priv->irqs[POWERKEY_UP]);
+			generic_handle_irq_safe(priv->irqs[POWERKEY_DOWN]);
+			generic_handle_irq_safe(priv->irqs[POWERKEY_UP]);
 			pending &= ~HISI_IRQ_POWERKEY_UP_DOWN;
 		}
 
@@ -126,7 +126,7 @@ static irqreturn_t hi6421v600_irq_handler(int irq, void *__priv)
 			continue;
 
 		for_each_set_bit(offset, &pending, BITS_PER_BYTE) {
-			generic_handle_irq(priv->irqs[offset + i * BITS_PER_BYTE]);
+			generic_handle_irq_safe(priv->irqs[offset + i * BITS_PER_BYTE]);
 		}
 	}
 

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2022-03-02 21:35 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 18:14 [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Sebastian Andrzej Siewior
2022-02-11 18:14 ` [PATCH v4 1/7] genirq: Provide generic_handle_irq_safe() Sebastian Andrzej Siewior
2022-02-21 11:19   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2022-02-11 18:14 ` [PATCH v4 2/7] i2c: core: Use generic_handle_irq_safe() in i2c_handle_smbus_host_notify() Sebastian Andrzej Siewior
2022-02-23 13:21   ` Wolfram Sang
2022-02-25 22:26     ` Sebastian Andrzej Siewior
2022-03-01 15:06       ` Wolfram Sang
2022-02-11 18:14 ` [PATCH v4 3/7] i2c: cht-wc: Use generic_handle_irq_safe() Sebastian Andrzej Siewior
2022-02-23 13:21   ` Wolfram Sang
2022-02-11 18:14 ` [PATCH v4 4/7] misc: hi6421-spmi-pmic: " Sebastian Andrzej Siewior
2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2022-02-11 18:14 ` [PATCH v4 5/7] mfd: ezx-pcap: " Sebastian Andrzej Siewior
2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2022-02-11 18:14 ` [PATCH v4 6/7] net: usb: lan78xx: " Sebastian Andrzej Siewior
2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2022-02-11 18:15 ` [PATCH v4 7/7] staging: greybus: gpio: " Sebastian Andrzej Siewior
2022-03-02 21:35   ` [tip: irq/core] " tip-bot2 for Sebastian Andrzej Siewior
2022-02-15 14:36 ` [PATCH v4 0/7] Provide and use generic_handle_irq_safe() where appropriate Lee Jones
2022-02-15 14:50   ` Sebastian Andrzej Siewior
2022-02-15 15:16     ` Lee Jones
2022-02-15 15:33       ` Sebastian Andrzej Siewior
2022-02-15 15:42         ` Lee Jones
2022-02-15 15:46           ` Sebastian Andrzej Siewior
2022-02-21  9:57           ` Thomas Gleixner
2022-02-21 11:33             ` Thomas Gleixner
2022-02-21 12:38               ` Lee Jones
2022-02-23 13:19               ` Wolfram Sang

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.