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

[Xen-changelog] [xen master] libxl/PCI: establish per-device reserved memory policy earlier



commit 6fdb8eef873b82bf771eb7c74c5d9236c3fa28c4
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Feb 27 15:44:17 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 27 15:44:17 2020 +0100

    libxl/PCI: establish per-device reserved memory policy earlier
    
    Reserved device memory region processing as well as E820 table creation
    happen earlier than the adding of (PCI) devices, yet they consume the
    policy (e.g. to decide whether to add entries to the E820 table). But so
    far it was only at the stage of PCI device addition that the final
    policy was established (i.e. if not explicitly specified by the guest
    config file).
    
    Note that I couldn't find the domain ID to be available in
    libxl__domain_device_construct_rdm(), but observing that
    libxl__device_pci_setdefault() also doesn't use it, for the time being
    DOMID_INVALID gets passed. An obvious alternative would be to drop the
    unused parameter/argument, yet at that time the question would be
    whether to also drop other unused ones.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Wei Liu <wl@xxxxxxx>
---
 tools/libxl/libxl_dm.c       | 5 +++++
 tools/libxl/libxl_internal.h | 2 ++
 tools/libxl/libxl_pci.c      | 4 ++--
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 736f1cecac..e0c3aa4998 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -488,6 +488,11 @@ int libxl__domain_device_construct_rdm(libxl__gc *gc,
 
         assert(xrdm);
 
+        rc = libxl__device_pci_setdefault(gc, DOMID_INVALID,
+                                          &d_config->pcidevs[i], false);
+        if (rc)
+            goto out;
+
         for (n = 0; n < nr_entries; ++n) {
             bool new = true;
 
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 43e5885d1e..4891722a6b 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1709,6 +1709,8 @@ _hidden void libxl__device_pci_add(libxl__egc *egc, 
uint32_t domid,
                                    libxl__ao_device *aodev);
 _hidden void libxl__device_pci_destroy_all(libxl__egc *egc, uint32_t domid,
                                            libxl__multidev *);
+_hidden int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid,
+                                         libxl_device_pci *pci, bool hotplug);
 _hidden bool libxl__is_igd_vga_passthru(libxl__gc *gc,
                                         const libxl_domain_config *d_config);
 
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index f91bce07ec..3cf346c23e 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -1483,8 +1483,8 @@ static int libxl__device_pci_reset(libxl__gc *gc, 
unsigned int domain, unsigned
     return -1;
 }
 
-static int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid,
-                                        libxl_device_pci *pci, bool hotplug)
+int libxl__device_pci_setdefault(libxl__gc *gc, uint32_t domid,
+                                 libxl_device_pci *pci, bool hotplug)
 {
     /* We'd like to force reserve rdm specific to a device by default.*/
     if (pci->rdm_policy == LIBXL_RDM_RESERVE_POLICY_INVALID)
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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