From: Jonathan Creekmore <jonathan.creekmore@gmail.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
xen-devel@lists.xenproject.org,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com
Subject: Re: [PATCH v2] libxenstore: prefer using the character device
Date: Mon, 31 Aug 2015 13:59:24 -0500 [thread overview]
Message-ID: <m2lhcrwagj.fsf@Nebula.lan> (raw)
In-Reply-To: <55E03089.7080009@citrix.com> (David Vrabel's message of "Fri, 28 Aug 2015 10:57:29 +0100")
Just wanted to follow-up and see if there was any more debate on
this, since I hadn't seen any other commentary since last week.
David Vrabel <david.vrabel@citrix.com> writes:
> On 27/08/15 19:03, Ian Jackson wrote:
>> Wei Liu writes ("Re: [Xen-devel] [PATCH v2] libxenstore: prefer using the character device"):
>>> On Thu, Aug 27, 2015 at 09:04:38AM -0500, Jonathan Creekmore wrote:
>>>> With the addition of FMODE_ATOMIC_POS in the Linux 3.14 kernel,
>>>> concurrent blocking file accesses to a single open file descriptor can
>>>> cause a deadlock trying to grab the file position lock. If a watch has
>>>> been set up, causing a read_thread to blocking read on the file
>>>> descriptor, then future writes that would cause the background read to
>>>> complete will block waiting on the file position lock before they can
>>>> execute. This race condition only occurs when libxenstore is accessing
>>>> the xenstore daemon through the /proc/xen/xenbus file and not through
>>>> the unix domain socket, which is the case when the xenstore daemon is
>>>> running as a stub domain or when oxenstored is passed
>>>> --disable-socket. Accessing the daemon from the true character device
>>>> also does not exhibit this problem.
>>>>
>>>> On Linux, prefer using the character device file over the proc file if
>>>> the character device exists.
>>
>> I confess I still see this as working around a kernel bug. Only this
>> time we are switching from a buggy to non-buggy kernel interface.
>
> /proc/xen/xenbus is deprecated. The tools should use the non-deprecated
> interface.
>
>> Why don't we have the kernel provide only non-buggy interfaces ?
>
> Fixing /proc/xen/xenbus is non-trival and since there's a fully working
> non-deprecated interface (/dev/xen/xenbus), it's unlikely that anyone is
> going to be inspired to fix it.
>
>>>> diff --git a/tools/xenstore/xs_lib.c b/tools/xenstore/xs_lib.c
>>>> index af4f75a..0c7744e 100644
>>>> --- a/tools/xenstore/xs_lib.c
>>>> +++ b/tools/xenstore/xs_lib.c
>>>> @@ -81,6 +81,8 @@ const char *xs_domain_dev(void)
>>>> #if defined(__RUMPUSER_XEN__) || defined(__RUMPRUN__)
>>>> return "/dev/xen/xenbus";
>>>> #elif defined(__linux__)
>>>> + if (access("/dev/xen/xenbus", F_OK) == 0)
>>>> + return "/dev/xen/xenbus";
>>
>> Also, previously xs_domain_dev was a function which simply returned a
>> static value. I feel vaguely uneasy at putting this kind of
>> autodetection logic here.
>
> "Vaguely uneasy"? Are we engineers or witchdoctors?
>
> xs_domain_dev() already does a system call to query the environment so
> it did not just "return a static value":
>
> const char *xs_domain_dev(void)
> {
> char *s = getenv("XENSTORED_PATH");
> if (s)
> return s;
> ...
>
> David
next prev parent reply other threads:[~2015-08-31 18:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 21:44 [PATCH] libxenstore: Use poll() with a non-blocking read() Jonathan Creekmore
2015-08-16 8:59 ` Ian Campbell
2015-08-17 0:46 ` Jonathan Creekmore
2015-08-17 13:44 ` Boris Ostrovsky
2015-08-18 9:48 ` David Vrabel
2015-08-18 14:49 ` Jonathan Creekmore
2015-08-27 14:04 ` [PATCH v2] libxenstore: prefer using the character device Jonathan Creekmore
2015-08-27 16:56 ` Wei Liu
2015-08-27 18:03 ` Ian Jackson
2015-08-27 20:34 ` Jonathan Creekmore
2015-08-28 9:57 ` David Vrabel
2015-08-31 18:59 ` Jonathan Creekmore [this message]
2015-09-01 10:56 ` Wei Liu
2015-09-01 11:28 ` Ian Jackson
2015-09-01 12:03 ` Ian Campbell
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=m2lhcrwagj.fsf@Nebula.lan \
--to=jonathan.creekmore@gmail.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 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.