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

Re: [PATCH v2 6/8] xen/arm: Add XEN_DOMCTL_dt_overlay DOMCTL and related operations


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Henry Wang <xin.wang2@xxxxxxx>
  • Date: Fri, 17 May 2024 09:36:05 +0800
  • 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=arcselector9901; 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=Q6J0+vyCm0AQ02DpB102APuTG9J+GZ8JwgNCnPIcxMs=; b=S4MoQnIHacoeimQc7yKTZEroqle/2bvopAQ3WO93SYvc5x3Jw6SxOhNRQScR02GlK/PO+KIK2O4fhvBFOvXriJdk+beZOAH0FBBWT+LZBF1ub84adS+wIFwVzsNOZqH3zd9elZMeQqejrW0ThZBF7WTDhq+yDOC/PzYpJ0zsxcju8PWqGRe/gIUdazj5xldJyygujCL2P0rgqpeBUBwJRlydFD80R14VXHR4LW2y2bbedC00k+5jy8blIYhizPRB3i4f2KuGdah1VJ880yRroMkXz4N+aQDCu3g6U4czS/w7z+xpZuOAAGZQHotQBqYQ4/xRYaAAo6e/e2FN0HQTQA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gbaTTCM9d8O4r0uAjK8PDbO/zeR0kbf7AA1vioUO9b9Oxv9NmLHDQLimSxtKHhdQiJtcTK8VdCMzo6mXz6g9xKck4TGUnV9+Li431oEQ664c08SpArKdyx+854a55tIrPZ+Zqvqej2A9/T/1dVl92DELKhQ23RAbFGtpZjKMha5XYgry7DdGQM1Pn0F09gOkyTy6HMn8N+M6F/MtZD9Gs35iqmp1ETekouvLqbcdSDmRxdNaMWZYgrHEyt2rV7lJiNXGpyKu4DVJiMwKi7uKpjeJaKWiqZXr40sD1yRkr8sI5YHhGjU0vHEetNQVZojbicdsS20F+qE/TKYctcMHFg==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 17 May 2024 01:36:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Jan,

As usual, thanks for the review!

On 5/16/2024 8:31 PM, Jan Beulich wrote:
On 16.05.2024 12:03, Henry Wang wrote:

+    /*
+     * First check if dtbo is correct i.e. it should one of the dtbo which was
+     * used when dynamically adding the node.
+     * Limitation: Cases with same node names but different property are not
+     * supported currently. We are relying on user to provide the same dtbo
+     * as it was used when adding the nodes.
+     */
+    list_for_each_entry_safe( entry, temp, &overlay_tracker, entry )
+    {
+        if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) == 0 )
+        {
+            track = entry;
Random question (not doing a full review of the DT code): What use is
this (and the track variable itself)? It's never used further down afaics.
Same for attach.

I think you are correct, it is a copy paste of the existing code and the track variable is indeed useless. So in v3, I will simply drop it and mention this clean-up in commit message. Also I realized that the exact logic of finding the entry is duplicated third times, so I will also extract the logic to a function.

--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1190,6 +1190,17 @@ struct xen_domctl_vmtrace_op {
  typedef struct xen_domctl_vmtrace_op xen_domctl_vmtrace_op_t;
  DEFINE_XEN_GUEST_HANDLE(xen_domctl_vmtrace_op_t);
+#if defined(__arm__) || defined (__aarch64__)
Nit: Consistent use of blanks please (also again below).

Good catch. Will fix it.

+struct xen_domctl_dt_overlay {
+    XEN_GUEST_HANDLE_64(const_void) overlay_fdt;  /* IN: overlay fdt. */
+    uint32_t overlay_fdt_size;              /* IN: Overlay dtb size. */
+#define XEN_DOMCTL_DT_OVERLAY_ATTACH                3
+#define XEN_DOMCTL_DT_OVERLAY_DETACH                4
While the numbers don't really matter much, picking 3 and 4 rather than,
say, 1 and 2 still looks a little odd.

Well although I agree with you it is indeed a bit odd, the problem of this is that, in current implementation I reused the libxl_dt_overlay() (with proper backward compatible) to deliver the sysctl and domctl depend on the op, and we have:
#define LIBXL_DT_OVERLAY_ADD                   1
#define LIBXL_DT_OVERLAY_REMOVE                2
#define LIBXL_DT_OVERLAY_ATTACH                3
#define LIBXL_DT_OVERLAY_DETACH                4

Then the op-number is passed from the toolstack to Xen, and checked in dt_overlay_domctl(). So with this implementation the attach/detach op number should be 3 and 4 since 1 and 2 have different meanings.

But I realized that I can also implement a similar API, say libxl_dt_overlay_domain() and that way we can reuse 1 and 2 and there is not even need to provide backward compatible of libxl_dt_overlay(). So would you mind sharing your preference on which approach would you like more? Thanks!

--- a/xen/include/xen/dt-overlay.h
+++ b/xen/include/xen/dt-overlay.h
@@ -14,6 +14,7 @@
  #include <xen/device_tree.h>
  #include <xen/list.h>
  #include <xen/rangeset.h>
+#include <public/domctl.h>
Why? All you need here ...

@@ -42,12 +43,18 @@ struct xen_sysctl_dt_overlay;
#ifdef CONFIG_OVERLAY_DTB
  long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op);
+long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op);
... is a forward declaration of struct xen_domctl_dt_overlay.

Oh indeed. Will fix this. Thanks!

Kind regards,
Henry


Jan




 


Rackspace

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