Skip to content

Commit 3a3e2b8

Browse files
committed
firmware: arm_ffa: Avoid queuing work when running on the worker queue
Currently notif_pcpu_irq_work_fn() may get queued from the work that is already running on the 'notif_pcpu_wq' workqueue. This may add unnecessary delays and could be avoided if the work is called directly instead. This change removes queuing of the work when already running on the 'notif_pcpu_wq' workqueue thereby removing any possible delays in that path. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sudeep Holla <[email protected]>
1 parent ddfade8 commit 3a3e2b8

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

drivers/firmware/arm_ffa/driver.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ static void handle_notif_callbacks(u64 bitmap, enum notify_type type)
11461146
}
11471147
}
11481148

1149-
static void notif_pcpu_irq_work_fn(struct work_struct *work)
1149+
static void notif_get_and_handle(void *unused)
11501150
{
11511151
int rc;
11521152
struct ffa_notify_bitmaps bitmaps;
@@ -1169,10 +1169,17 @@ ffa_self_notif_handle(u16 vcpu, bool is_per_vcpu, void *cb_data)
11691169
struct ffa_drv_info *info = cb_data;
11701170

11711171
if (!is_per_vcpu)
1172-
notif_pcpu_irq_work_fn(&info->notif_pcpu_work);
1172+
notif_get_and_handle(info);
11731173
else
1174-
queue_work_on(vcpu, info->notif_pcpu_wq,
1175-
&info->notif_pcpu_work);
1174+
smp_call_function_single(vcpu, notif_get_and_handle, info, 0);
1175+
}
1176+
1177+
static void notif_pcpu_irq_work_fn(struct work_struct *work)
1178+
{
1179+
struct ffa_drv_info *info = container_of(work, struct ffa_drv_info,
1180+
notif_pcpu_work);
1181+
1182+
ffa_self_notif_handle(smp_processor_id(), true, info);
11761183
}
11771184

11781185
static const struct ffa_info_ops ffa_drv_info_ops = {
@@ -1345,8 +1352,10 @@ static irqreturn_t ffa_sched_recv_irq_handler(int irq, void *irq_data)
13451352
static irqreturn_t notif_pend_irq_handler(int irq, void *irq_data)
13461353
{
13471354
struct ffa_pcpu_irq *pcpu = irq_data;
1355+
struct ffa_drv_info *info = pcpu->info;
13481356

1349-
ffa_self_notif_handle(smp_processor_id(), true, pcpu->info);
1357+
queue_work_on(smp_processor_id(), info->notif_pcpu_wq,
1358+
&info->notif_pcpu_work);
13501359

13511360
return IRQ_HANDLED;
13521361
}

0 commit comments

Comments
 (0)