Skip to content

Commit

Permalink
Revert "soc: qcom: smp2p: Prevent suspend for threaded irq"
Browse files Browse the repository at this point in the history
This reverts commit 9dcdb6f.

The IRQ subsystem already blocks suspend on waiting for IRQ threads to
finish running (in dpm_noirq_begin()). This PM wakeup does nothing but add
latency to the IRQ handler for non-RT kernels, and it isn't RT-friendly
either:
[   42.466403] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974
[   42.466407] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper/3
[   42.466408] Preemption disabled at:
[   42.466421] [<00000000100c9f7d>] secondary_start_kernel+0xa8/0x130
[   42.466427] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G S      W       4.14.212-rt102-Sultan #1
[   42.466429] Hardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM sm8150 Coral (DT)
[   42.466432] Call trace:
[   42.466436]  dump_backtrace+0x0/0x1ac
[   42.466439]  show_stack+0x14/0x1c
[   42.466444]  dump_stack+0x84/0xac
[   42.466448]  ___might_sleep+0x140/0x150
[   42.466452]  rt_spin_lock+0x3c/0x50
[   42.466458]  __pm_stay_awake+0x20/0x50
[   42.466462]  qcom_smp2p_isr+0x10/0x1c
[   42.466467]  __handle_irq_event_percpu+0x60/0xd4
[   42.466469]  handle_irq_event_percpu+0x58/0xb0
[   42.466471]  handle_irq_event+0x68/0xe0
[   42.466474]  handle_fasteoi_irq+0x140/0x1fc
[   42.466476]  generic_handle_irq+0x18/0x2c
[   42.466478]  __handle_domain_irq+0xf8/0xfc
[   42.466481]  gic_handle_irq+0xc8/0x164
[   42.466483]  el1_irq+0xb0/0x130
[   42.466487]  finish_task_switch+0xcc/0x1e4
[   42.466491]  __schedule+0x3f0/0x4e0
[   42.466493]  schedule_idle+0x28/0x44
[   42.466497]  do_idle+0x78/0x230
[   42.466500]  cpu_startup_entry+0x20/0x28
[   42.466502]  secondary_start_kernel+0x124/0x130

Remove it since it's useless.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: Zlatan Radovanovic <zlatan.radovanovic@fet.ba>
  • Loading branch information
kerneltoast authored and hxsyzl committed Feb 9, 2025
1 parent c0cf07a commit c3ba2f5
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions drivers/soc/qcom/smp2p.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <linux/soc/qcom/smem.h>
#include <linux/soc/qcom/smem_state.h>
#include <linux/spinlock.h>
#include <linux/pm_wakeup.h>

#include <linux/ipc_logging.h>

Expand Down Expand Up @@ -153,7 +152,6 @@ struct qcom_smp2p {
struct regmap *ipc_regmap;
int ipc_offset;
int ipc_bit;
struct wakeup_source *ws;

struct mbox_client mbox_client;
struct mbox_chan *mbox_chan;
Expand Down Expand Up @@ -297,14 +295,6 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)
}
}

static irqreturn_t qcom_smp2p_isr(int irq, void *data)
{
struct qcom_smp2p *smp2p = data;

__pm_stay_awake(smp2p->ws);
return IRQ_WAKE_THREAD;
}

/**
* qcom_smp2p_intr() - interrupt handler for incoming notifications
* @irq: unused
Expand All @@ -329,7 +319,7 @@ static irqreturn_t qcom_smp2p_intr(int irq, void *data)
if (IS_ERR(in)) {
dev_err(smp2p->dev,
"Unable to acquire remote smp2p item\n");
goto out;
return IRQ_HANDLED;
}

smp2p->in = in;
Expand All @@ -348,8 +338,6 @@ static irqreturn_t qcom_smp2p_intr(int irq, void *data)
qcom_smp2p_do_ssr_ack(smp2p);
}

out:
__pm_relax(smp2p->ws);
return IRQ_HANDLED;
}

Expand Down Expand Up @@ -676,7 +664,7 @@ static int qcom_smp2p_probe(struct platform_device *pdev)
qcom_smp2p_kick(smp2p);

ret = devm_request_threaded_irq(&pdev->dev, smp2p->irq,
qcom_smp2p_isr, qcom_smp2p_intr,
NULL, qcom_smp2p_intr,
IRQF_ONESHOT,
"smp2p", (void *)smp2p);
if (ret) {
Expand Down Expand Up @@ -814,8 +802,6 @@ static int qcom_smp2p_freeze(struct device *dev)
/* make null to point it to valid smem item during first interrupt */
smp2p->in = NULL;
smp2p->valid_entries = 0;
/* remove wakeup source */
wakeup_source_unregister(smp2p->ws);
return 0;
}

Expand Down

0 comments on commit c3ba2f5

Please sign in to comment.