lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d825b484-9917-4ccf-b94d-a5446ff570a0@oracle.com>
Date: Tue, 4 Feb 2025 16:54:14 +1100
From: imran.f.khan@...cle.com
To: Haakon Bugge <haakon.bugge@...cle.com>
Cc: Tejun Heo <tj@...nel.org>,
        "jiangshanlai@...il.com"
 <jiangshanlai@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] workqueue: introduce
 queue_delayed_work_on_offline_safe.

Hello Haakon,
Thanks a lot for providing your feedback.

On 3/2/2025 10:48 pm, Haakon Bugge wrote:
> 
> 
> On 31 Jan 2025, at 12:16, Imran Khan <imran.f.khan@...cle.com> wrote:
>> Hello again Tejun,
>> sorry, just found one mistake in earlier shared patch, it
>> missed an unlock done below:
>>
>> Thanks,
>> Imran
>> On 31/1/2025 9:37 pm, imran.f.khan@...cle.com wrote:
>> Hello Tejun,
>>
>> [...]
>>
>> Could you kindly let me know, if it would be acceptable, to have
>> queue_delayed_work_on_offline_safe, as a wrapper around
>> queue_delayed_work_on, such that it can check and ensure CPU's
>> availability. If it can't, then it can simply return false and let
>> caller decide which cpu to use next. Something like below:
>>
>>
>> diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
>> index b0dc957c3e560..57f39807f3bf1 100644
>> --- a/include/linux/workqueue.h
>> +++ b/include/linux/workqueue.h
>> @@ -589,6 +589,9 @@ extern bool queue_work_node(int node, struct workqueue_struct *wq,
>>                            struct work_struct *work);
>> extern bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
>>                        struct delayed_work *work, unsigned long delay);
>> +extern bool queue_delayed_work_on_offline_safe(int cpu,
>> +                       struct workqueue_struct *wq, struct delayed_work *work,
>> +                       unsigned long delay);
> 
> Hi Imran,
> 
> 
> I am not quite sure this signature will be OK. See below.
> 
>> extern bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
>>                        struct delayed_work *dwork, unsigned long delay);
>> extern bool queue_rcu_work(struct workqueue_struct *wq, struct rcu_work *rwork);
>>
>> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
>> index 9362484a653c4..7d3b8050422e4 100644
>> --- a/kernel/workqueue.c
>> +++ b/kernel/workqueue.c
>> @@ -2565,6 +2565,37 @@ bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
>> }
>> EXPORT_SYMBOL(queue_delayed_work_on);
>>
>> +/**
>> + * queue_delayed_work_on_offline_safe - queue work on specific online CPU after
>> + *                                     delay,
>> + *
>> + * @cpu: CPU number to execute work on
>> + * @wq: workqueue to use
>> + * @dwork: work to queue
>> + * @delay: number of jiffies to wait before queueing
>> + *
>> + * a wrapper, around queue_delayed_work_on, that checks and ensures that
>> + * specified @cpu is online. If @cpu is found to be offline or if its online
>> + * status can't be reliably determined, return false and leave the decision,
>> + * of selecting new cpu for delayed_work, to caller.
> 
> The return value here is ambiguous.
>
Agree. Thanks for pointing this out. I have modified this patch,
as per your suggestion and have sent a v2 of my earlier approach.
Please see [1].

Could you please have a look and let me know your opinion.

Thanks,
Imran

[1]: https://lore.kernel.org/all/20250204054404.268888-1-imran.f.khan@oracle.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ