All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Henry Wang <Henry.Wang@arm.com>
To: Vikram Garhwal <vikram.garhwal@amd.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "sstabellini@kernel.org" <sstabellini@kernel.org>,
	"michal.orzel@amd.com" <michal.orzel@amd.com>,
	Julien Grall <julien@xen.org>
Subject: RE: [XEN][PATCH v6 14/19] common/device_tree: Add rwlock for dt_host
Date: Thu, 4 May 2023 04:38:26 +0000	[thread overview]
Message-ID: <AS8PR08MB799196697F990D65F00163C2926D9@AS8PR08MB7991.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20230502233650.20121-15-vikram.garhwal@amd.com>

Hi Vikram,

> -----Original Message-----
> Subject: [XEN][PATCH v6 14/19] common/device_tree: Add rwlock for dt_host
> 
>  Dynamic programming ops will modify the dt_host and there might be other
>  function which are browsing the dt_host at the same time. To avoid the race
>  conditions, adding rwlock for browsing the dt_host during runtime.

While now I understand why you use rwlock instead of spinlock in this patch
since you explained it in replying my comment in v5 (Thanks!). I would still
suggest that you can add that kind of explanation in the commit message to
make the commit message clear to everyone that reading this patch.

> 
> Signed-off-by: Vikram Garhwal <vikram.garhwal@amd.com>
> ---
>  xen/common/device_tree.c              |  4 ++++
>  xen/drivers/passthrough/device_tree.c | 18 ++++++++++++++++++
>  xen/include/xen/device_tree.h         |  6 ++++++
>  3 files changed, 28 insertions(+)
> 

[...]

>          ret = iommu_add_dt_device(dev);
>          if ( ret < 0 )
> @@ -310,6 +321,8 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl,
> struct domain *d,
>              printk(XENLOG_G_ERR "XEN_DOMCTL_assign_dt_device: assign
> \"%s\""
>                     " to dom%u failed (%d)\n",
>                     dt_node_full_name(dev), d->domain_id, ret);
> +
> +        read_unlock(&dt_host->lock);

Since you added "read_unlock(&dt_host->lock);" before the final return,
i.e. "return ret", I don't think you need to add "read_unlock(&dt_host->lock);"
here before the break. Or am I missing something?

>          break;
> 
>      case XEN_DOMCTL_deassign_device:
> @@ -328,11 +341,15 @@ int iommu_do_dt_domctl(struct xen_domctl
> *domctl, struct domain *d,
>              break;
> 
>          ret = xsm_deassign_dtdevice(XSM_HOOK, d, dt_node_full_name(dev));
> +

Nit: Unnecessary blank line addition here.

Kind regards,
Henry


  reply	other threads:[~2023-05-04  4:39 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02 23:36 [XEN][PATCH v6 00/19] dynamic node programming using overlay dtbo Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 01/19] xen/arm/device: Remove __init from function type Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 02/19] common/device_tree: handle memory allocation failure in __unflatten_device_tree() Vikram Garhwal
2023-05-04  3:54   ` Henry Wang
2023-05-05  9:38   ` Michal Orzel
     [not found]     ` <f854bfc4-1f3c-19df-ba22-89c8859cfe6d@amd.com>
2023-06-01  6:58       ` Michal Orzel
2023-05-02 23:36 ` [XEN][PATCH v6 03/19] common/device_tree: change __unflatten_device_tree() type Vikram Garhwal
2023-05-04  4:02   ` Henry Wang
2023-05-02 23:36 ` [XEN][PATCH v6 04/19] common/device_tree.c: unflatten_device_tree() propagate errors Vikram Garhwal
2023-05-04  4:08   ` Henry Wang
2023-05-02 23:36 ` [XEN][PATCH v6 05/19] xen/arm: Add CONFIG_OVERLAY_DTB Vikram Garhwal
2023-05-04  4:11   ` Henry Wang
2023-05-09 10:54     ` Michal Orzel
2023-05-02 23:36 ` [XEN][PATCH v6 06/19] libfdt: Keep fdt functions after init for CONFIG_OVERLAY_DTB Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 07/19] libfdt: overlay: change overlay_get_target() Vikram Garhwal
2023-05-04  4:13   ` Henry Wang
2023-05-02 23:36 ` [XEN][PATCH v6 08/19] xen/device-tree: Add device_tree_find_node_by_path() to find nodes in device tree Vikram Garhwal
2023-05-04  4:23   ` Henry Wang
2023-05-04  5:56     ` unsubscribe Terry Yang
2023-05-09 11:29     ` [XEN][PATCH v6 08/19] xen/device-tree: Add device_tree_find_node_by_path() to find nodes in device tree Michal Orzel
2023-05-31 21:31       ` Vikram Garhwal
2023-06-01  2:02         ` Henry Wang
2023-05-02 23:36 ` [XEN][PATCH v6 09/19] xen/iommu: Move spin_lock from iommu_dt_device_is_assigned to caller Vikram Garhwal
2023-05-03  7:53   ` Jan Beulich
2023-05-02 23:36 ` [XEN][PATCH v6 10/19] xen/iommu: protect iommu_add_dt_device() with dtdevs_lock Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 11/19] xen/iommu: Introduce iommu_remove_dt_device() Vikram Garhwal
2023-05-03  7:56   ` Jan Beulich
2023-05-02 23:36 ` [XEN][PATCH v6 12/19] xen/smmu: Add remove_device callback for smmu_iommu ops Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 13/19] asm/smp.h: Fix circular dependency for device_tree.h and rwlock.h Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 14/19] common/device_tree: Add rwlock for dt_host Vikram Garhwal
2023-05-04  4:38   ` Henry Wang [this message]
2023-05-02 23:36 ` [XEN][PATCH v6 15/19] xen/arm: Implement device tree node removal functionalities Vikram Garhwal
2023-05-03  7:59   ` Jan Beulich
2023-05-03  8:02   ` Jan Beulich
2023-05-09 14:30   ` Michal Orzel
2023-05-09 14:52     ` Andrew Cooper
2023-05-02 23:36 ` [XEN][PATCH v6 16/19] xen/arm: Implement device tree node addition functionalities Vikram Garhwal
2023-05-10 10:18   ` Michal Orzel
2023-06-02  0:49     ` Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 17/19] tools/libs/ctrl: Implement new xc interfaces for dt overlay Vikram Garhwal
2023-05-18 16:01   ` Anthony PERARD
2023-06-02  0:49     ` Vikram Garhwal
2023-05-02 23:36 ` [XEN][PATCH v6 18/19] tools/libs/light: Implement new libxl functions for device tree overlay ops Vikram Garhwal
2023-05-18 16:01   ` Anthony PERARD
2023-05-02 23:36 ` [XEN][PATCH v6 19/19] tools/xl: Add new xl command overlay for device tree overlay support Vikram Garhwal
2023-05-18 16:01   ` Anthony PERARD

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=AS8PR08MB799196697F990D65F00163C2926D9@AS8PR08MB7991.eurprd08.prod.outlook.com \
    --to=henry.wang@arm.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=vikram.garhwal@amd.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.