]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Add a new xenbus controller option for event channels
authorJim Fehlig <jfehlig@suse.com>
Tue, 7 Apr 2020 22:37:09 +0000 (16:37 -0600)
committerJim Fehlig <jfehlig@suse.com>
Thu, 9 Apr 2020 21:45:05 +0000 (15:45 -0600)
Event channels are like PV interrupts and in conjuction with grant frames
form a data transfer mechanism for PV drivers. They are also used for
inter-processor interrupts. Guests with a large number of vcpus and/or
many PV devices many need to increase the maximum default value of 1023.
For this reason the native Xen config format supports the
'max_event_channels' setting. See xl.cfg(5) man page for more details.

Similar to the existing maxGrantFrames option, add a new xenbus controller
option 'maxEventChannels', allowing to adjust the maximum value via libvirt.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h

index 47e10a836c47f128e5c2988164ff09df97ba1c53..8a4f7b1e8751af502908dfccebb413cec5cfbfe7 100644 (file)
     &lt;driver iothread='4'/&gt;
     &lt;address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/&gt;
   &lt;/controller&gt;
-  &lt;controller type='xenbus' maxGrantFrames='64'/&gt;
+  &lt;controller type='xenbus' maxGrantFrames='64' maxEventChannels='2047'/&gt;
   ...
 &lt;/devices&gt;
 ...</pre>
         <dd><span class="since">Since 5.2.0</span>, the <code>xenbus</code>
         controller has an optional attribute <code>maxGrantFrames</code>,
         which specifies the maximum number of grant frames the controller
-        makes available for connected devices.</dd>
+        makes available for connected devices.
+        <span class="since">Since 6.3.0</span>, the xenbus controller
+        supports the optional <code>maxEventChannels</code> attribute,
+        which specifies maximum number of event channels (PV interrupts)
+        that can be used by the guest.</dd>
       </dl>
 
     <p>
index 12e842cec562f7d7f046f033c57207aa85c1d209..f7eeb0200f063a2f752f2c09f06e4ec5af057912 100644 (file)
                 <ref name="unsignedInt"/>
               </attribute>
             </optional>
+            <optional>
+              <attribute name="maxEventChannels">
+                <ref name="unsignedInt"/>
+              </attribute>
+            </optional>
           </group>
         </choice>
         <optional>
index c478d79554e24065e9e5b97f1d54884008fefa7b..639d47142456ac78bd6d4dfa78227523ae32cf1a 100644 (file)
@@ -2262,6 +2262,7 @@ virDomainControllerDefNew(virDomainControllerType type)
         break;
     case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS:
         def->opts.xenbusopts.maxGrantFrames = -1;
+        def->opts.xenbusopts.maxEventChannels = -1;
         break;
     case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
     case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
@@ -11364,6 +11365,7 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
         break;
     case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: {
         g_autofree char *gntframes = virXMLPropString(node, "maxGrantFrames");
+        g_autofree char *eventchannels = virXMLPropString(node, "maxEventChannels");
 
         if (gntframes) {
             int r = virStrToLong_i(gntframes, NULL, 10,
@@ -11374,6 +11376,15 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt,
                 goto error;
             }
         }
+        if (eventchannels) {
+            int r = virStrToLong_i(eventchannels, NULL, 10,
+                                   &def->opts.xenbusopts.maxEventChannels);
+            if (r != 0 || def->opts.xenbusopts.maxEventChannels < 0) {
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("Invalid maxEventChannels: %s"), eventchannels);
+                goto error;
+            }
+        }
         break;
     }
 
@@ -25314,6 +25325,10 @@ virDomainControllerDefFormat(virBufferPtr buf,
             virBufferAsprintf(&attrBuf, " maxGrantFrames='%d'",
                               def->opts.xenbusopts.maxGrantFrames);
         }
+        if (def->opts.xenbusopts.maxEventChannels != -1) {
+            virBufferAsprintf(&attrBuf, " maxEventChannels='%d'",
+                              def->opts.xenbusopts.maxEventChannels);
+        }
         break;
 
     default:
index 33e1e2235c8fcdfb972fbc5fdb214784948890dd..9310fab16971107fad680a66b5221a59f413f614 100644 (file)
@@ -730,6 +730,7 @@ struct _virDomainUSBControllerOpts {
 
 struct _virDomainXenbusControllerOpts {
     int maxGrantFrames;   /* -1 == undef */
+    int maxEventChannels; /* -1 == undef */
 };
 
 /* Stores the virtual disk controller configuration */