* [PATCH 0/6] spin lock usage optimization for RTC drivers
@ 2021-02-03 12:39 Xiaofei Tan
2021-02-03 12:39 ` [PATCH 1/6] rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ Xiaofei Tan
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
Replace spin_lock_irqsave with spin_lock in hard IRQ of RTC drivers.
There is no function changes, but may speed up if interrupt happen
too often.
Xiaofei Tan (6):
rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ
rtc: pm8xxx: Replace spin_lock_irqsave with spin_lock in hard IRQ
rtc: r7301: Replace spin_lock_irqsave with spin_lock in hard IRQ
rtc: tegra: Replace spin_lock_irqsave with spin_lock in hard IRQ
rtc: mxc: Replace spin_lock_irqsave with spin_lock in hard IRQ
rtc: mxc_v2: Replace spin_lock_irqsave with spin_lock in hard IRQ
drivers/rtc/rtc-cmos.c | 5 ++---
drivers/rtc/rtc-mxc.c | 5 ++---
drivers/rtc/rtc-mxc_v2.c | 7 +++----
drivers/rtc/rtc-pm8xxx.c | 9 ++++-----
drivers/rtc/rtc-r7301.c | 5 ++---
drivers/rtc/rtc-tegra.c | 6 +++---
6 files changed, 16 insertions(+), 21 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
@ 2021-02-03 12:39 ` Xiaofei Tan
2021-02-03 12:39 ` [PATCH 2/6] rtc: pm8xxx: " Xiaofei Tan
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
It is redundant to do irqsave and irqrestore in hardIRQ context, where
it has been in a irq-disabled context.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/rtc/rtc-cmos.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 68a9ac6..d46f59a 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -649,11 +649,10 @@ static struct cmos_rtc cmos_rtc;
static irqreturn_t cmos_interrupt(int irq, void *p)
{
- unsigned long flags;
u8 irqstat;
u8 rtc_control;
- spin_lock_irqsave(&rtc_lock, flags);
+ spin_lock(&rtc_lock);
/* When the HPET interrupt handler calls us, the interrupt
* status is passed as arg1 instead of the irq number. But
@@ -687,7 +686,7 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
hpet_mask_rtc_irq_bit(RTC_AIE);
CMOS_READ(RTC_INTR_FLAGS);
}
- spin_unlock_irqrestore(&rtc_lock, flags);
+ spin_unlock(&rtc_lock);
if (is_intr(irqstat)) {
rtc_update_irq(p, 1, irqstat);
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] rtc: pm8xxx: Replace spin_lock_irqsave with spin_lock in hard IRQ
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
2021-02-03 12:39 ` [PATCH 1/6] rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ Xiaofei Tan
@ 2021-02-03 12:39 ` Xiaofei Tan
2021-02-03 12:39 ` [PATCH 3/6] rtc: r7301: " Xiaofei Tan
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
It is redundant to do irqsave and irqrestore in hardIRQ context, where
it has been in a irq-disabled context.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/rtc/rtc-pm8xxx.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 0d9dd6f..92642aa 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -343,16 +343,15 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
const struct pm8xxx_rtc_regs *regs = rtc_dd->regs;
unsigned int ctrl_reg;
int rc;
- unsigned long irq_flags;
rtc_update_irq(rtc_dd->rtc, 1, RTC_IRQF | RTC_AF);
- spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags);
+ spin_lock(&rtc_dd->ctrl_reg_lock);
/* Clear the alarm enable bit */
rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg);
if (rc) {
- spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
+ spin_unlock(&rtc_dd->ctrl_reg_lock);
goto rtc_alarm_handled;
}
@@ -360,13 +359,13 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg);
if (rc) {
- spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
+ spin_unlock(&rtc_dd->ctrl_reg_lock);
dev_err(rtc_dd->rtc_dev,
"Write to alarm control register failed\n");
goto rtc_alarm_handled;
}
- spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags);
+ spin_unlock(&rtc_dd->ctrl_reg_lock);
/* Clear RTC alarm register */
rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl2, &ctrl_reg);
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] rtc: r7301: Replace spin_lock_irqsave with spin_lock in hard IRQ
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
2021-02-03 12:39 ` [PATCH 1/6] rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ Xiaofei Tan
2021-02-03 12:39 ` [PATCH 2/6] rtc: pm8xxx: " Xiaofei Tan
@ 2021-02-03 12:39 ` Xiaofei Tan
2021-02-03 12:39 ` [PATCH 4/6] rtc: tegra: " Xiaofei Tan
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
It is redundant to do irqsave and irqrestore in hardIRQ context, where
it has been in a irq-disabled context.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/rtc/rtc-r7301.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-r7301.c b/drivers/rtc/rtc-r7301.c
index aaf1b95..5dbaeb7 100644
--- a/drivers/rtc/rtc-r7301.c
+++ b/drivers/rtc/rtc-r7301.c
@@ -320,11 +320,10 @@ static irqreturn_t rtc7301_irq_handler(int irq, void *dev_id)
{
struct rtc_device *rtc = dev_id;
struct rtc7301_priv *priv = dev_get_drvdata(rtc->dev.parent);
- unsigned long flags;
irqreturn_t ret = IRQ_NONE;
u8 alrm_ctrl;
- spin_lock_irqsave(&priv->lock, flags);
+ spin_lock(&priv->lock);
rtc7301_select_bank(priv, 1);
@@ -335,7 +334,7 @@ static irqreturn_t rtc7301_irq_handler(int irq, void *dev_id)
rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF);
}
- spin_unlock_irqrestore(&priv->lock, flags);
+ spin_unlock(&priv->lock);
return ret;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] rtc: tegra: Replace spin_lock_irqsave with spin_lock in hard IRQ
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
` (2 preceding siblings ...)
2021-02-03 12:39 ` [PATCH 3/6] rtc: r7301: " Xiaofei Tan
@ 2021-02-03 12:39 ` Xiaofei Tan
2021-02-03 12:39 ` [PATCH 5/6] rtc: mxc: " Xiaofei Tan
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
It is redundant to do irqsave and irqrestore in hardIRQ context, where
it has been in a irq-disabled context.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/rtc/rtc-tegra.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 8925015..85f7ad5 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -232,7 +232,7 @@ static irqreturn_t tegra_rtc_irq_handler(int irq, void *data)
{
struct device *dev = data;
struct tegra_rtc_info *info = dev_get_drvdata(dev);
- unsigned long events = 0, flags;
+ unsigned long events = 0;
u32 status;
status = readl(info->base + TEGRA_RTC_REG_INTR_STATUS);
@@ -240,10 +240,10 @@ static irqreturn_t tegra_rtc_irq_handler(int irq, void *data)
/* clear the interrupt masks and status on any IRQ */
tegra_rtc_wait_while_busy(dev);
- spin_lock_irqsave(&info->lock, flags);
+ spin_lock(&info->lock);
writel(0, info->base + TEGRA_RTC_REG_INTR_MASK);
writel(status, info->base + TEGRA_RTC_REG_INTR_STATUS);
- spin_unlock_irqrestore(&info->lock, flags);
+ spin_unlock(&info->lock);
}
/* check if alarm */
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] rtc: mxc: Replace spin_lock_irqsave with spin_lock in hard IRQ
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
` (3 preceding siblings ...)
2021-02-03 12:39 ` [PATCH 4/6] rtc: tegra: " Xiaofei Tan
@ 2021-02-03 12:39 ` Xiaofei Tan
2021-02-03 12:39 ` [PATCH 6/6] rtc: mxc_v2: " Xiaofei Tan
2021-02-05 23:52 ` [PATCH 0/6] spin lock usage optimization for RTC drivers Alexandre Belloni
6 siblings, 0 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
It is redundant to do irqsave and irqrestore in hardIRQ context, where
it has been in a irq-disabled context.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/rtc/rtc-mxc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index 65b29b0..db57dda7 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -189,11 +189,10 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id)
struct platform_device *pdev = dev_id;
struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
void __iomem *ioaddr = pdata->ioaddr;
- unsigned long flags;
u32 status;
u32 events = 0;
- spin_lock_irqsave(&pdata->rtc->irq_lock, flags);
+ spin_lock(&pdata->rtc->irq_lock);
status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR);
/* clear interrupt sources */
writew(status, ioaddr + RTC_RTCISR);
@@ -209,7 +208,7 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id)
events |= (RTC_PF | RTC_IRQF);
rtc_update_irq(pdata->rtc, 1, events);
- spin_unlock_irqrestore(&pdata->rtc->irq_lock, flags);
+ spin_unlock(&pdata->rtc->irq_lock);
return IRQ_HANDLED;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] rtc: mxc_v2: Replace spin_lock_irqsave with spin_lock in hard IRQ
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
` (4 preceding siblings ...)
2021-02-03 12:39 ` [PATCH 5/6] rtc: mxc: " Xiaofei Tan
@ 2021-02-03 12:39 ` Xiaofei Tan
2021-02-05 23:52 ` [PATCH 0/6] spin lock usage optimization for RTC drivers Alexandre Belloni
6 siblings, 0 replies; 8+ messages in thread
From: Xiaofei Tan @ 2021-02-03 12:39 UTC (permalink / raw)
To: a.zummo, alexandre.belloni; +Cc: Xiaofei Tan, linux-rtc, linux-kernel, linuxarm
It is redundant to do irqsave and irqrestore in hardIRQ context, where
it has been in a irq-disabled context.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
drivers/rtc/rtc-mxc_v2.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-mxc_v2.c b/drivers/rtc/rtc-mxc_v2.c
index 0d73f6f..a577a74 100644
--- a/drivers/rtc/rtc-mxc_v2.c
+++ b/drivers/rtc/rtc-mxc_v2.c
@@ -74,13 +74,12 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id)
struct device *dev = dev_id;
struct mxc_rtc_data *pdata = dev_get_drvdata(dev);
void __iomem *ioaddr = pdata->ioaddr;
- unsigned long flags;
u32 lp_status;
u32 lp_cr;
- spin_lock_irqsave(&pdata->lock, flags);
+ spin_lock(&pdata->lock);
if (clk_enable(pdata->clk)) {
- spin_unlock_irqrestore(&pdata->lock, flags);
+ spin_unlock(&pdata->lock);
return IRQ_NONE;
}
@@ -104,7 +103,7 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id)
mxc_rtc_sync_lp_locked(dev, ioaddr);
clk_disable(pdata->clk);
- spin_unlock_irqrestore(&pdata->lock, flags);
+ spin_unlock(&pdata->lock);
return IRQ_HANDLED;
}
--
2.8.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] spin lock usage optimization for RTC drivers
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
` (5 preceding siblings ...)
2021-02-03 12:39 ` [PATCH 6/6] rtc: mxc_v2: " Xiaofei Tan
@ 2021-02-05 23:52 ` Alexandre Belloni
6 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2021-02-05 23:52 UTC (permalink / raw)
To: Xiaofei Tan, a.zummo; +Cc: Alexandre Belloni, linux-kernel, linuxarm, linux-rtc
On Wed, 3 Feb 2021 20:39:35 +0800, Xiaofei Tan wrote:
> Replace spin_lock_irqsave with spin_lock in hard IRQ of RTC drivers.
> There is no function changes, but may speed up if interrupt happen
> too often.
>
> Xiaofei Tan (6):
> rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ
> rtc: pm8xxx: Replace spin_lock_irqsave with spin_lock in hard IRQ
> rtc: r7301: Replace spin_lock_irqsave with spin_lock in hard IRQ
> rtc: tegra: Replace spin_lock_irqsave with spin_lock in hard IRQ
> rtc: mxc: Replace spin_lock_irqsave with spin_lock in hard IRQ
> rtc: mxc_v2: Replace spin_lock_irqsave with spin_lock in hard IRQ
>
> [...]
Applied, thanks!
[1/6] rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ
commit: 6950d046eb6eabbc271fda416460c05f7a85698a
[2/6] rtc: pm8xxx: Replace spin_lock_irqsave with spin_lock in hard IRQ
commit: 51317975565329ee50e52d0fffce50566b43cc2d
[3/6] rtc: r7301: Replace spin_lock_irqsave with spin_lock in hard IRQ
commit: be3df3f85897e36163bfb764549acc69ec9b7afa
[4/6] rtc: tegra: Replace spin_lock_irqsave with spin_lock in hard IRQ
commit: 669022c29af672205aaf53b76fd594dad2661ffe
[5/6] rtc: mxc: Replace spin_lock_irqsave with spin_lock in hard IRQ
commit: 3f2d30184773e408c4e6f9e15c350828e482480c
[6/6] rtc: mxc_v2: Replace spin_lock_irqsave with spin_lock in hard IRQ
commit: 0c1095d334dafda22463454b0519c926447b555e
Best regards,
--
Alexandre Belloni <alexandre.belloni@bootlin.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-02-06 3:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 12:39 [PATCH 0/6] spin lock usage optimization for RTC drivers Xiaofei Tan
2021-02-03 12:39 ` [PATCH 1/6] rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ Xiaofei Tan
2021-02-03 12:39 ` [PATCH 2/6] rtc: pm8xxx: " Xiaofei Tan
2021-02-03 12:39 ` [PATCH 3/6] rtc: r7301: " Xiaofei Tan
2021-02-03 12:39 ` [PATCH 4/6] rtc: tegra: " Xiaofei Tan
2021-02-03 12:39 ` [PATCH 5/6] rtc: mxc: " Xiaofei Tan
2021-02-03 12:39 ` [PATCH 6/6] rtc: mxc_v2: " Xiaofei Tan
2021-02-05 23:52 ` [PATCH 0/6] spin lock usage optimization for RTC drivers Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).