Linux CXL
 help / color / mirror / Atom feed
From: Marc Herbert <Marc.Herbert@linux.intel.com>
To: "ruansy.fnst" <ruansy.fnst@fujitsu.com>, linux-cxl@vger.kernel.org
Cc: dan.j.williams@intel.com, vishal.l.verma@intel.com,
	sunfishho12@gmail.com
Subject: cxl <-> udev deadlock?
Date: Fri, 16 May 2025 16:50:57 -0700	[thread overview]
Message-ID: <ef46edd7-b492-4124-9cf9-0db104175eac@linux.intel.com> (raw)
In-Reply-To: <20250514112003.2150272-1-ruansy.fnst@fujitsu.com>

On 2025-05-14 04:20, ruansy.fnst wrote:
> 
> Now that cxl_wait_probe() has been added[1] to wait for udev queue
> empty, the `udevadm settle` here is no longer necessary.
> 
> [1] b231603 cxl/lib: Add cxl_wait_probe()
> 
> Signed-off-by: Ruan Shiyang <ruansy.fnst@fujitsu.com>
> 
> ===
> Question to Dan:
> 
> I understand how cxl_wait_probe() work, but I have some questions about
> the motivation of adding this function:  Firstly, is it function added
> for simply waiting for new added CXL device been ready before cxl
> command does the actual work?  Just for replacing `udevadm settle`'s
> work?
> 
> Now I am facing a problem that cxl command takes a long time to complete
> when I run it in a udev rule(do some configuration when CXL memdev is
> added).  I found it is caused by this function: waitting for udev
> queue's endding but itself is in the queue.  The cxl_wait_probe()
> function does not seem to allow me to do that.  So, the 2nd question is:
> is it against the spec to run cxl command in a udev rule?

cxl waits for udev which waits for cxl... this looks like an interesting
deadlock!?

When you write "a long time to complete", do you mean "aborted after the
default, 180s udev timeout?"

https://www.freedesktop.org/software/systemd/man/latest/systemd-udevd.service.html

udev is not designed to start long-running processes BUT udev is designed
to communicate with systemd which is the correct manager for all
long-running processes:

https://www.freedesktop.org/software/systemd/man/latest/systemd.device.html

You can find examples on your system like this:

  grep -r SYSTEMD_.*WANT /usr/lib/udev/

Now, I think you are not interested in running anything for _long_. But,
the same technique and indirection should also break the deadlock (if any)
because udev messages to systemd are "fire and forget".

Also, systemd is designed to collect and report logs, exit status
etc. which is very useful when something goes wrong. udev does not
do that.

  parent reply	other threads:[~2025-05-16 23:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 11:20 [PATCH] test/cxl-xor-region.sh: remove redundant waitting ruansy.fnst
2025-05-16 21:36 ` Alison Schofield
2025-05-20  3:54   ` Shiyang Ruan
2025-05-16 23:50 ` Marc Herbert [this message]
2025-05-17  0:23 ` dan.j.williams
2025-05-19 21:47   ` Marc Herbert
2025-05-19 23:09     ` Dan Williams
2025-05-20  1:00       ` Marc Herbert
2025-05-20  3:38         ` Shiyang Ruan
2025-05-20  5:26           ` Marc Herbert
2025-05-28 20:49 ` Alison Schofield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef46edd7-b492-4124-9cf9-0db104175eac@linux.intel.com \
    --to=marc.herbert@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ruansy.fnst@fujitsu.com \
    --cc=sunfishho12@gmail.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox