xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Quan Xu <quan.xu@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Feng Wu <feng.wu@intel.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Dario Faggioli <dario.faggioli@citrix.com>,
	xen-devel@lists.xen.org,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v3 2/2] IOMMU/spinlock: Make the pcidevs_lock a recursive one
Date: Thu, 10 Mar 2016 02:52:48 -0700	[thread overview]
Message-ID: <56E1520002000078000DB243@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1457529455-38314-3-git-send-email-quan.xu@intel.com>

>>> On 09.03.16 at 14:17, <quan.xu@intel.com> wrote:
> Signed-off-by: Quan Xu <quan.xu@intel.com>
> Acked-by: Kevin Tian <kevin.tian@intel.com>

The patch itself looks mostly fine now (see below for the minor left
issues), but the complete lack of a description (which should state
why this change is being done) makes this not ready to go in
anyway.

> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -48,7 +48,7 @@ struct pci_seg {
>      } bus2bridge[MAX_BUSES];
>  };
>  
> -spinlock_t pcidevs_lock = SPIN_LOCK_UNLOCKED;
> +static spinlock_t _pcidevs_lock = SPIN_LOCK_UNLOCKED;

Why the renaming?

> @@ -103,6 +103,26 @@ static int pci_segments_iterate(
>      return rc;
>  }
>  
> +void pcidevs_lock(void)
> +{
> +    spin_lock_recursive(&_pcidevs_lock);
> +}
> +
> +void pcidevs_unlock(void)
> +{
> +    spin_unlock_recursive(&_pcidevs_lock);
> +}
> +
> +int pcidevs_is_locked(void)

bool_t

> +{
> +    return spin_is_locked(&_pcidevs_lock);
> +}
> +
> +int pcidevs_trylock(void)

bool_t

(To avoid another round, please be aware that the underlying
spin lock primitives still [wrongly] use "int", so to be fully correct
you will need to use !! in both return statements, unless you
feel like (in another prereq patch) to adjust those primitives too.

> +{
> +    return spin_trylock_recursive(&_pcidevs_lock);
> +}

I also think that it would be a good idea to place these helpers
and the lock definition next to each other.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-03-10  9:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 13:17 [PATCH v3 0/2] Make the pcidevs_lock a recursive one Quan Xu
2016-03-09 13:17 ` [PATCH v3 1/2] IOMMU/spinlock: Fix a bug found in AMD IOMMU initialization Quan Xu
2016-03-09 14:59   ` Dario Faggioli
2016-03-10  6:12     ` Xu, Quan
2016-03-11  3:24   ` Meng Xu
2016-03-11  6:54     ` Xu, Quan
2016-03-11 10:35       ` Dario Faggioli
2016-03-11 12:36         ` Xu, Quan
2016-03-11 13:58           ` Dario Faggioli
2016-03-11 14:49           ` Meng Xu
2016-03-11 15:55             ` Dario Faggioli
2016-03-11 17:17               ` Meng Xu
2016-03-11 14:41         ` Meng Xu
2016-03-11 16:12           ` Dario Faggioli
2016-03-09 13:17 ` [PATCH v3 2/2] IOMMU/spinlock: Make the pcidevs_lock a recursive one Quan Xu
2016-03-09 17:45   ` Dario Faggioli
2016-03-10  1:21     ` Xu, Quan
2016-03-10  9:52   ` Jan Beulich [this message]
2016-03-10 11:27     ` Xu, Quan
2016-03-10 13:06       ` Jan Beulich

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=56E1520002000078000DB243@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=feng.wu@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=quan.xu@intel.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).