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

Re: [PATCH for-4.17 v1 0/2] xenctrl.ml: improve scalability of domain_getinfolist


  • To: Christian Lindig <christian.lindig@xxxxxxxxxx>
  • From: Edwin Torok <edvin.torok@xxxxxxxxxx>
  • Date: Wed, 2 Nov 2022 09:37:08 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • 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=YxfV0c7AEX9Hh2v2XHDix8xVkGkplYsJTKmoiFyajgw=; b=Kserjiw07Tmot/JVLSCDS2SeRL8BgZZN0V2+UsqRPMXRxZ2BH7Q3OYvKDHHi/myqSNJsebQNekSu0YyI0w3OZWqPNpMjLSYt7pCV7caJRdnJJIeO170xK5kqdFy9ni78auO35avEkzQGhIIG8qtxNJ58I7S1JcAdHlQWYnPvdIoa/Yc03Lg466TVMfwv+TMSlL7mnQUbQrn8yR/7mQ3Qkdfy3ren8y1KnctuXaKALHn12xcgQWVZ4Z97UCRsCzFHHlp2JLsB0m0HUKrK3RQeibNWILGJTELArmjofOteY9DC42ISCZiPHqsFxPVz6CgLmZo6ntaKiEy5xYBlcXfqDg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XPcp0xFqBMQP/5IXjjU3em6lNIrCieC8NCWqXMUSbkzeDbeXsXb5FPXll8k5dJdz2dwsRrzILpnYcO98TJuRpOguVAYlodIyL8vmH2Z5OhZNLTWqg5USpRdIsEHbN0ZtZnSnjO402+xKAOGRp3UPjRXK5GduKym5oOs1OdWugaJch79KE+NXQMM6tcQOnZYaKvMwFkOA8R2sK8FweoG6wGRzLqyZEMwvMrwGPILijWNXR+etl/EnUfLxpMZ1LDz9NDjYWQlB8tbvCEpEtWgCrZ1IpZ9VgIXb/cK3VU2xXZuSKGOW+Pv+mmiNcI91fv8IsP0DN7RpqFgaapZ0Haq4Cg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Pau Ruiz Safont <pau.safont@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Delivery-date: Wed, 02 Nov 2022 09:37:34 +0000
  • Ironport-data: A9a23:ZG0jSqJXdoSYtLKyFE+R95QlxSXFcZb7ZxGr2PjKsXjdYENSgzRWy GNLUW2BMvuMYmvwf9gga4SwpksHucXcmIJhTABlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHv+kUrWs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPewP9TlK6q4mlB5wRkPakjUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c56GUQUz 8YjcgkGVU6DgP+3+pyre+xV05FLwMnDZOvzu1lG5BSAVbMMZ8+GRK/Ho9hFwD03m8ZCW+7EY NYUYiZuaxKGZABTPlAQC9Q1m+LAanvXKmUE7g7K4/VvpTGLnGSd05C0WDbRUtGGW8RT2Fqfv GXF12/4HgsbJJqUzj/tHneE1rGSx3ilAtJ6+LuQyqdmr3TKxUUvVUM0UnaCm/SI0na1RIcKQ 6AT0m90xUQoz2S7Q9+4UxCmrXqsuh8HR8EWA+A88BuKyKff/0CeHGdsZjJIdtEOrsI9Qj0uk FiTkLvBGjhHoLCTD3WH+d+pQSiaPCEUKSoIY3ACRA5cu937+thr3lTIU8ppF7OzgpvtAzbsz juWrS84wbIOkcoM0Kb99lfC696xmqX0oscOzl2/dgqYAslRPdDNi1CAgbQD0ct9EQ==
  • Ironport-hdrordr: A9a23:5/r3gau5uev87LVbnWIsURKB7skC1YMji2hC6mlwRA09TyXGra 2TdaUgvyMc1gx7ZJh5o6H6BEGBKUmslqKceeEqTPqftXrdyRGVxeZZnMffKlzbamfDH4tmuZ uIHJIOb+EYYWIasS++2njBLz9C+qjJzEnLv5a5854Fd2gDBM9dBkVCe3+m+yZNNWt77O8CZf 6hD7181l+dkBosDviTNz0gZazuttfLnJXpbVotHBg88jSDijuu9frTDwWY9g12aUIP/Z4StU z+1yDp7KSqtP+2jjXG0XXI0phQkNz9jvNeGc23jNQPIDmEsHfpWG0hYczAgNkGmpDr1L8Yqq iJn/7mBbU115rlRBD2nfIq4Xin7N9h0Q669bbSuwqfnSWwfkNHNyMGv/MWTvKR0TtfgPhslK 1MxG6XrJxREFfJmzn8/cHBU1VwmlOzumdKq59bs5TOObFuF4O5gLZvi3+9Kq1wah7S+cQiCq 1jHcvc7PFZfReTaG3YpHBmxJipUm4oFhmLT0AesojNugIm10xR3g8d3ogSj30A/JUyR91N4P nFKL1hkPVLQtUNZaxwCe8dSY+8C3DLQxjLLGWOSG6XXJ0vKjbIsdr68b817OaldNgBy4Yzgo 3IVBdCuWs7ayvVeLmzNV1wg2XwqUmGLEfQI5tllulEU5XHNcrWGDzGTkwymM29pPhaCtHHWp +ISeBrP8M=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHY7hu6Hfeu3cnxk0m/6L4xh+MTgK4rWegAgAAHLYA=
  • Thread-topic: [PATCH for-4.17 v1 0/2] xenctrl.ml: improve scalability of domain_getinfolist


> On 2 Nov 2022, at 09:11, Christian Lindig <christian.lindig@xxxxxxxxxx> wrote:
> 
> 
> 
>> On 1 Nov 2022, at 17:59, Edwin Török <edvin.torok@xxxxxxxxxx> wrote:
>> 
>> 
>> Edwin Török (2):
>> xenctrl.ml: make domain_getinfolist tail recursive
>> xenctrl: use larger chunksize in domain_getinfolist
>> 
>> tools/ocaml/libs/xc/xenctrl.ml | 25 ++++++++++++++++++-------
>> 1 file changed, 18 insertions(+), 7 deletions(-)
> 
> Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
> 
> 
>> It was calling the Xen domainfolist hypercall N/2 times.
>> Optimize this such that it is called at most 2 times during normal use.
>> 
>> Implement a tail recursive `rev_concat` equivalent to `concat |> rev`,
>> and use it instead of calling `@` multiple times.
> 
> Are there any assurances about the order in elements returned by 
> domain_getinfolist? I understand that the change maintains the current 
> behaviour but are we even required to maintain that order? Because otherwise 
> we could return the reverse list and save more work.


After some discussion with Andrew Cooper apparently the xenctrl API is broken 
and cannot be used safely as is, so I'll be rewriting this patch.
Domids can be assigned randomly, or toolstacks can set a custom domid, so it is 
not guaranteed that new domids always show up as higher numbers,
and the only safe way to use infolist is to either request 1 domid, or request 
them all (domids are 15-bit, so 32768).
Anything else is prone to race conditions and might give you an inconsistent 
snapshot.

This is probably better fixed by changing the prototype of the C function in 
xenctrl to not take a count to force updating all callers
(the callers in the 'xl' toolstack are just as buggy as the one in this OCaml 
binding, and probably better to fix the API in xenctrl than working around the 
race condition in each caller).

Stay tuned for more patches...

Best regards,
--Edwin

 


Rackspace

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