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

Re: [PATCH] xen: add option to disable GNTTABOP_transfer



On 03.02.22 10:10, Jan Beulich wrote:
On 01.02.2022 10:02, Juergen Gross wrote:
The grant table operation GNTTABOP_transfer is meant to be used in
PV device backends, and it hasn't been used in Linux since the old
Xen-o-Linux days.

Kind of unusual spelling of XenoLinux ;-)

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -181,6 +181,7 @@ static int parse_gnttab_max_maptrack_frames(const char *arg)
unsigned int __read_mostly opt_gnttab_max_version = GNTTAB_MAX_VERSION;
  static bool __read_mostly opt_transitive_grants = true;
+static bool __read_mostly opt_grant_transfer = true;

If this was conditional upon PV (with a #define to false in the
opposite case), it could be __ro_after_init right away, while at
the same time allowing the compiler to eliminate gnttab_transfer().

Nice idea. The other option would be to put all (or most) of
gnttab_transfer() in a "#ifdef CONFIG_PV" section, allowing to
remove the "#ifdef CONFIG_X86" parts in it, too.


@@ -204,6 +205,8 @@ static int __init parse_gnttab(const char *s)
          }
          else if ( (val = parse_boolean("transitive", s, ss)) >= 0 )
              opt_transitive_grants = val;
+        else if ( (val = parse_boolean("transfer", s, ss)) >= 0 )
+            opt_grant_transfer = val;
          else
              rc = -EINVAL;

To possibly save a further roundtrip: If the PV dependency was added
above, I'd like to ask to follow the model of parse_iommu_param()
here and use "#ifndef opt_grant_transfer" around the added code in
favor of "#ifdef CONFIG_PV".

Okay.


@@ -2233,6 +2236,9 @@ gnttab_transfer(
      unsigned int max_bitsize;
      struct active_grant_entry *act;
+ if ( !opt_grant_transfer )
+        return -ENOSYS;

-EOPNOTSUPP please.

Yes, that's better.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


 


Rackspace

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