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: <CAKf6xpsv-v0kMXnuOVmkjOXYV+R=HPnKWL9cufZaNEa6+3jvMw@mail.gmail.com>
Date:   Thu, 20 May 2021 13:31:01 -0400
From:   Jason Andryuk <jandryuk@...il.com>
To:     Tejun Heo <tj@...nel.org>
Cc:     Lai Jiangshan <jiangshanlai@...il.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: Calling queue_work() multiple times with the same work_struct

Hello, Tejun.

On Thu, May 20, 2021 at 1:01 PM Tejun Heo <tj@...nel.org> wrote:
>
> Hello, Jason.
>
> On Thu, May 20, 2021 at 08:39:56AM -0400, Jason Andryuk wrote:
> > 1 & 2 look supported from workqueue.h.  Is the 3rd case true and
> > guaranteed?  Is it okay to re-use the same work_struct in that case
>
> Yes.
>
> > while it's being executed?  A work_struct function can re-queue
>
> Yes.
>
> > itself, so I hope #3 is supported.
>
> Yes.
>
> > DECLARE_WORK(argo_work, argo_work_fn);
> > static struct workqueue_struct *argo_wq = alloc_workqueue("argo_wq",
> >                     WQ_UNBOUND | WQ_HIGHPRI | WQ_CPU_INTENSIVE | WQ_SYSFS, 1);
>
> I don't know what the device is but does it need both HIGHPRI and
> CPU_INTENSIVE?

argo is a Xen inter-vm communication mechanism, so networking-ish.  I
wanted HIGHPRI to ensure it is run promptly.  I wasn't sure about
CPU_INTENSIVE, but high data rates could potentially copy a fair
amount of data.  HIGHPRI alone may be sufficient.

> > static void argo_work_fn(struct work_struct *work)
> > {
> >     argo_interrupt_rx();  /* iterates multiple "rings" */
> >     argo_notify();
> > }
> >
> > static irqreturn_t argo_interrupt(int irq, void *dev_id)
> > {
> >     queue_work(argo_wq, &argo_work);
> >
> >     return IRQ_HANDLED;
> > }
>
> Yeah, the above will guarantee that the work function would run at least
> once since the last invocation of argo_interrupt().

Awesome.  Thank you, Tejun.

Regards,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ