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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250716085055.GJ721198@horms.kernel.org>
Date: Wed, 16 Jul 2025 09:50:55 +0100
From: Simon Horman <horms@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Cindy Lu <lulu@...hat.com>, virtualization@...ts.linux-foundation.org,
	netdev@...r.kernel.org, Jason Wang <jasowang@...hat.com>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Mike Christie <michael.christie@...cle.com>,
	Nicolas Dichtel <nicolas.dichtel@...nd.com>,
	Stefano Garzarella <sgarzare@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v13] vhost: Reintroduces support of kthread API and adds
 mode selection

On Tue, Jul 15, 2025 at 08:43:45PM +0200, Markus Elfring wrote:
> > This patch reintroduces kthread mode for vhost workers and provides
> > configuration to select between kthread and task worker.
> …
> 
> Is there a need to reconsider the relevance once more for the presented
> cover letter?
> 
> 
> …
> > +++ b/drivers/vhost/vhost.c
> …
> > +static int vhost_attach_task_to_cgroups(struct vhost_worker *worker)
> > +{
> …
> > +	vhost_worker_queue(worker, &attach.work);
> > +
> > +	mutex_lock(&worker->mutex);
> …
> > +	worker->attachment_cnt = saved_cnt;
> > +
> > +	mutex_unlock(&worker->mutex);
> …
> 
> Under which circumstances would you become interested to apply a statement
> like “guard(mutex)(&worker->mutex);”?
> https://elixir.bootlin.com/linux/v6.16-rc6/source/include/linux/mutex.h#L225

Quoting the documentation, I'd suggest these circumstances:

  1.6.5. Using device-managed and cleanup.h constructs

  Netdev remains skeptical about promises of all “auto-cleanup” APIs,
  including even devm_ helpers, historically. They are not the preferred
  style of implementation, merely an acceptable one.

  Use of guard() is discouraged within any function longer than 20 lines,
  scoped_guard() is considered more readable. Using normal lock/unlock is
  still (weakly) preferred.

  Low level cleanup constructs (such as __free()) can be used when building
  APIs and helpers, especially scoped iterators. However, direct use of
  __free() within networking core and drivers is discouraged. Similar
  guidance applies to declaring variables mid-function.

https://docs.kernel.org/6.16-rc6/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs

IOW, the code is fine as-is.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ