[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/8] tools/libs/store: add support to use watches with a depth parameter


  • To: Juergen Gross <jgross@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 20 Apr 2026 17:30:03 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PWp1CJlN0rtlCETeaL43ZIyeO2c4LQXofeHK9g4Gvs4=; b=G6H2jrAz5E0PRaPfsWxWht1sdtmgm3FsVIfp5ZT24MsEmvq9vYy6xacXllAv3Hk+VGo8WHNf8VZsWYn3h/7O80yS9nXDBrtwqzU3xHUM5W+sJkF3UGP6KEdveThIdIYMaj1H8T40E4TtIc8V985uz9uusEIsZ78nvPVVDfiWiB9rfpKqMmvdHV61DOmRxCFAJsVBNl4Z4Wpv1DHDeWhiaDth0mX9TnIHf9n5GmVfFsDUv0AWuCoXACWg2ZQeYRRKLeQlSizebChDCm66/tSngKfSuLUOMmovFN1SfposRem+B2tLJn0PGltLNLR4BQFxlEBA2/EBG9tKvZeA8QoeBQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ns7BPWiTjRLYjE1enpz6X0utBliU0gUOGPAaNd3jmGltmM2FxALGNiKUwrrAb/nyuobjSsynv7O7Eaaa7chKuF/v01FyaBjfazDsda7NlTfgZ2L9+1kdi3Ec1pkvKVlUShdJ32y1GmyIRMXAJAkI6KYAYOWxa43mk1pnKAAtxjVxwBZ62cIfTX0V5sBlioj8Dds1x4ts4+vwH+jwy5joemO7anM4ne+jb5nr4BjjibNs2WLeKs3oK7fW4mWKn8z50OhRPLBiuqUo/3Usw5kM7lxI5USc7ZYXboMZvKJvaQYjV/yPg+yPIpTpsGwrB8hjEl5RbZYkKDxyaYyMmgHFlQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Mon, 20 Apr 2026 21:30:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-03-13 03:47, Juergen Gross wrote:
Add a new xs_watch_depth() function to libxenstore allowing to limit
the scope of a Xenstore watch. It can be used only in case Xenstore is
supporting the XENSTORE_SERVER_FEATURE_WATCHDEPTH feature.

For convenience add a xs_watch_try_depth() wrapper, which will call
xs_watch_depth() if supported and xs_watch() otherwise.

Cache the supported features of Xenstore in order not having to get
them from Xenstore for each call of one of the new functions.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

@@ -984,37 +984,29 @@ bool xs_restrict(struct xs_handle *h, unsigned domid)
        return false;
  }
-/* Watch a node for changes (poll on fd to detect, or call read_watch()).
- * When the node (or any child) changes, fd will become readable.
- * Token is returned when watch is read, to allow matching.
- * Returns false on failure.
- */
-bool xs_watch(struct xs_handle *h, const char *path, const char *token)
+static bool xs_watch_helper(struct xs_handle *h)
  {
-       struct xsd_sockmsg msg = { .type = XS_WATCH };
-       struct iovec iov[3];
-
  #ifdef USE_PTHREAD
+       sigset_t set, old_set;
+       pthread_attr_t attr;
+       static size_t stack_size;
+#ifdef USE_DLSYM
+       size_t (*getsz)(pthread_attr_t *attr);
+#endif
+
  #define DEFAULT_THREAD_STACKSIZE (16 * 1024)
  /* NetBSD doesn't have PTHREAD_STACK_MIN. */
  #ifndef PTHREAD_STACK_MIN
  # define PTHREAD_STACK_MIN 0
  #endif
-#define READ_THREAD_STACKSIZE \
-       ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?    \
+#define READ_THREAD_STACKSIZE                                  \
+       ((DEFAULT_THREAD_STACKSIZE < PTHREAD_STACK_MIN) ?    \
         PTHREAD_STACK_MIN : DEFAULT_THREAD_STACKSIZE)
/* We dynamically create a reader thread on demand. */
        mutex_lock(&h->request_mutex);
        if (!h->read_thr_exists) {
-               sigset_t set, old_set;
-               pthread_attr_t attr;
-               static size_t stack_size;
-#ifdef USE_DLSYM
-               size_t (*getsz)(pthread_attr_t *attr);
-#endif

AFAICT, there is no particular reason to change the scope of these variables. Am I missing something?

Everything else looks okay.

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.