All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Jürgen Groß" <jgross@suse.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>, "Wei Liu" <wl@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	xen-devel@lists.xenproject.org,
	"Daniel De Graaf" <dgdegra@tycho.nsa.gov>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v8 04/12] xen: add basic hypervisor filesystem support
Date: Fri, 15 May 2020 11:27:55 +0200	[thread overview]
Message-ID: <ae9db4d5-993a-5bf6-c520-3aec428cdc5d@suse.com> (raw)
In-Reply-To: <28dd8109-1815-70cd-834c-53330d5c824d@suse.com>

On 15.05.2020 07:33, Jürgen Groß wrote:
> On 14.05.20 11:50, Jürgen Groß wrote:
>> On 14.05.20 09:59, Jan Beulich wrote:
>>> On 08.05.2020 17:34, Juergen Gross wrote:
>>>> +int hypfs_read_dir(const struct hypfs_entry *entry,
>>>> +                   XEN_GUEST_HANDLE_PARAM(void) uaddr)
>>>> +{
>>>> +    const struct hypfs_entry_dir *d;
>>>> +    const struct hypfs_entry *e;
>>>> +    unsigned int size = entry->size;
>>>> +
>>>> +    d = container_of(entry, const struct hypfs_entry_dir, e);
>>>> +
>>>> +    list_for_each_entry ( e, &d->dirlist, list )
>>>
>>> This function, in particular because of being non-static, makes
>>> me wonder how, with add_entry() taking a lock, it can be safe
>>> without any locking. Initially I thought the justification might
>>> be because all adding of entries is an init-time-only thing, but
>>> various involved functions aren't marked __init (and it is at
>>> least not implausible that down the road we might see new
>>> entries getting added during certain hotplug operations).
>>>
>>> I do realize that do_hypfs_op() takes the necessary read lock,
>>> but then you're still building on the assumption that the
>>> function is reachable through only that code path, despite
>>> being non-static. An ASSERT() here would be the minimum I guess,
>>> but with read locks now being recursive I don't see why you
>>> couldn't read-lock here again.
>>
>> Right, will add the read-lock.
>>
>>>
>>> The same goes for other non-static functions, albeit things may
>>> become more interesting for functions living on the
>>> XEN_HYPFS_OP_write_contents path (because write locks aren't
>>
>> Adding an ASSERT() in this regard should be rather easy.
> 
> As the type specific read- and write-functions should only be called
> through the generic read/write functions I think it is better to have
> a percpu variable holding the current locking state and ASSERT() that
> to match. This will be cheaper than nesting locks and I don't have to
> worry about either write_lock nesting or making _is_write_locked_by_me()
> an official interface.

Ah yes, this should do.

Jan


  reply	other threads:[~2020-05-15  9:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-08 15:34 [PATCH v8 00/12] Add hypervisor sysfs-like support Juergen Gross
2020-05-08 15:34 ` [PATCH v8 01/12] xen/vmx: let opt_ept_ad always reflect the current setting Juergen Gross
2020-05-08 15:34 ` [PATCH v8 02/12] xen: add a generic way to include binary files as variables Juergen Gross
2020-05-08 15:34 ` [PATCH v8 03/12] docs: add feature document for Xen hypervisor sysfs-like support Juergen Gross
2020-05-08 15:34 ` [PATCH v8 04/12] xen: add basic hypervisor filesystem support Juergen Gross
2020-05-14  7:59   ` Jan Beulich
2020-05-14  9:50     ` Jürgen Groß
2020-05-14 11:58       ` Jan Beulich
2020-05-14 12:12         ` Jürgen Groß
2020-05-15  5:33       ` Jürgen Groß
2020-05-15  9:27         ` Jan Beulich [this message]
2020-05-14  9:55   ` Jan Beulich
2020-05-14  9:58     ` Jürgen Groß
2020-05-08 15:34 ` [PATCH v8 05/12] libs: add libxenhypfs Juergen Gross
2020-05-08 15:34 ` [PATCH v8 06/12] tools: add xenfs tool Juergen Gross
2020-05-08 15:34 ` [PATCH v8 07/12] xen: provide version information in hypfs Juergen Gross
2020-05-08 15:34 ` [PATCH v8 08/12] xen: add /buildinfo/config entry to hypervisor filesystem Juergen Gross
2020-05-14  9:32   ` Jan Beulich
2020-05-14  9:52     ` Jürgen Groß
2020-05-08 15:34 ` [PATCH v8 09/12] xen: add runtime parameter access support to hypfs Juergen Gross
2020-05-14 10:20   ` Jan Beulich
2020-05-14 11:48     ` Jürgen Groß
2020-05-14 12:10       ` Jan Beulich
2020-05-14 14:56         ` Jürgen Groß
2020-05-14 15:02           ` Jan Beulich
2020-05-14 15:43             ` Jürgen Groß
2020-05-08 15:34 ` [PATCH v8 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters Juergen Gross
2020-05-08 15:34 ` [PATCH v8 11/12] tools/libxc: remove xc_set_parameters() Juergen Gross
2020-05-08 15:34 ` [PATCH v8 12/12] xen: remove XEN_SYSCTL_set_parameter support Juergen Gross
2020-05-14 13:03   ` Jan Beulich
2020-05-14 14:58     ` Jürgen Groß

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=ae9db4d5-993a-5bf6-c520-3aec428cdc5d@suse.com \
    --to=jbeulich@suse.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=george.dunlap@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --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.