All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xen/xenbus: log more information when device state got reset
@ 2026-08-03  3:08 Marek Marczykowski-Górecki
  2026-08-03  3:08 ` [PATCH 2/2] xen/xenbus: check otherend_id only after it has been initialized Marek Marczykowski-Górecki
  2026-08-03 14:16 ` [PATCH 1/2] xen/xenbus: log more information when device state got reset Juergen Gross
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Marczykowski-Górecki @ 2026-08-03  3:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Marczykowski-Górecki, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jason Andryuk,
	Martin K. Petersen, Jakub Kicinski,
	moderated list:XEN HYPERVISOR INTERFACE

Ease diagnosing what actually changed.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 drivers/xen/xenbus/xenbus_probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index eb260eceb4d2..a259c8f0fff4 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -686,7 +686,8 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
 			 * and new one needs to be probed.
 			 */
 			dev_warn(&dev->dev,
-				 "state reset occurred, reconnecting\n");
+				 "state reset occurred (xenstore state %u, local state %u, xenstore backend %u, local backend %u), reconnecting\n",
+				 state, dev->state, backend, dev->otherend_id);
 			dev->vanished = true;
 		}
 		if (dev->vanished) {
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] xen/xenbus: check otherend_id only after it has been initialized
  2026-08-03  3:08 [PATCH 1/2] xen/xenbus: log more information when device state got reset Marek Marczykowski-Górecki
@ 2026-08-03  3:08 ` Marek Marczykowski-Górecki
  2026-08-03 14:16   ` Juergen Gross
  2026-08-03 14:16 ` [PATCH 1/2] xen/xenbus: log more information when device state got reset Juergen Gross
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Marczykowski-Górecki @ 2026-08-03  3:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Marczykowski-Górecki, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jakub Kicinski,
	Bjorn Helgaas, Jason Andryuk,
	moderated list:XEN HYPERVISOR INTERFACE

When device just got initialized (for example on module load), the
otherend_id field is initialized only after
xenbus_read_otherend_details() gets called. If xenstore watch triggers
xenbus_dev_changed() before that, it might consider still zeroed
otherend_id field (not matching actual xenstore content) as a sign of
device state reset. It can happen because xenstore watch are handled in
another thread (xenwatch), which can run in parallel to the initial
device probe running at module load. In that case, it would call
device_unregister(), which would deadlock against device probe from
module init.

Fix this by considering dev->otherend_id change only after dev->otherend
is set (which happen after otherend_id is initialized).

Fixes: e2dcf9065536 "xen/xenbus: better handle backend crash"
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 drivers/xen/xenbus/xenbus_probe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index a259c8f0fff4..b42d8d2e5a33 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -680,7 +680,8 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus)
 							    dev->otherend_id);
 
 		if (state == XenbusStateInitialising &&
-		    (state != dev->state || backend != dev->otherend_id)) {
+		    (state != dev->state ||
+		     (dev->otherend && backend != dev->otherend_id))) {
 			/*
 			 * State has been reset, assume the old one vanished
 			 * and new one needs to be probed.
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] xen/xenbus: log more information when device state got reset
  2026-08-03  3:08 [PATCH 1/2] xen/xenbus: log more information when device state got reset Marek Marczykowski-Górecki
  2026-08-03  3:08 ` [PATCH 2/2] xen/xenbus: check otherend_id only after it has been initialized Marek Marczykowski-Górecki
@ 2026-08-03 14:16 ` Juergen Gross
  1 sibling, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2026-08-03 14:16 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki, linux-kernel
  Cc: Stefano Stabellini, Oleksandr Tyshchenko, Jason Andryuk,
	Martin K. Petersen, Jakub Kicinski,
	moderated list:XEN HYPERVISOR INTERFACE


[-- Attachment #1.1.1: Type: text/plain, Size: 242 bytes --]

On 03.08.26 05:08, Marek Marczykowski-Górecki wrote:
> Ease diagnosing what actually changed.
> 
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] xen/xenbus: check otherend_id only after it has been initialized
  2026-08-03  3:08 ` [PATCH 2/2] xen/xenbus: check otherend_id only after it has been initialized Marek Marczykowski-Górecki
@ 2026-08-03 14:16   ` Juergen Gross
  0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2026-08-03 14:16 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki, linux-kernel
  Cc: Stefano Stabellini, Oleksandr Tyshchenko, Jakub Kicinski,
	Bjorn Helgaas, Jason Andryuk,
	moderated list:XEN HYPERVISOR INTERFACE


[-- Attachment #1.1.1: Type: text/plain, Size: 1037 bytes --]

On 03.08.26 05:08, Marek Marczykowski-Górecki wrote:
> When device just got initialized (for example on module load), the
> otherend_id field is initialized only after
> xenbus_read_otherend_details() gets called. If xenstore watch triggers
> xenbus_dev_changed() before that, it might consider still zeroed
> otherend_id field (not matching actual xenstore content) as a sign of
> device state reset. It can happen because xenstore watch are handled in
> another thread (xenwatch), which can run in parallel to the initial
> device probe running at module load. In that case, it would call
> device_unregister(), which would deadlock against device probe from
> module init.
> 
> Fix this by considering dev->otherend_id change only after dev->otherend
> is set (which happen after otherend_id is initialized).
> 
> Fixes: e2dcf9065536 "xen/xenbus: better handle backend crash"
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-03 14:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  3:08 [PATCH 1/2] xen/xenbus: log more information when device state got reset Marek Marczykowski-Górecki
2026-08-03  3:08 ` [PATCH 2/2] xen/xenbus: check otherend_id only after it has been initialized Marek Marczykowski-Górecki
2026-08-03 14:16   ` Juergen Gross
2026-08-03 14:16 ` [PATCH 1/2] xen/xenbus: log more information when device state got reset Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.