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

Re: [PATCH] Updates to Xen hypercall preemption


  • To: Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 22 Jun 2023 14:05:13 +0100
  • 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=SejNFEGIpUrYNvrB53UHodRPuQldY5yxAEE23suo6wI=; b=bTR9YrIYYQ0kg0SzPRQV38MHE7aATI7cE7aPCdqejpMQafDvVSI4HMJdXYKoTzP82xaBWj2Ty9ZrOVimbYlkB+bvobnC9X9QMubIlUly2cdySn+fA53QkpmFLi5InOvaTLvFfVtnuP/lJ4cR/8itOnjGF7OFh4e6LB1QOQ5O7oCM8qOuoWQ0aY0qf1k2u7NHmsZYIc5pTT95mDYoZvuTeiWCJFV/EfwlW+r6jc3+e1vyAzOmqm18/im0yraCqAxonlOElXRv4u6bMvbmWRQHZ61wfMsAdADd8eWZVNsfdqvO0Ml0rhhCCVnWxg745BHR/ebWYPvrJWPI/aZlQWzyfQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YtM+7V4YmdF3+rCk7G21N5tnY4qVsiDgVS249O6+h1deaONKQfmcfxY0QZ2GhhF4nkQZy698gUSrL+CqBRJGlbsLYPEZ0QQa1pBJSITKbiwGC5nXf2Gktqf+IA6haNQAk/+Qsgy7qZ2wEYMgHPED6NmOkyQAGCJBMiA98TDPSzxLLE+JklJlHSTiErHaS/9TYjcHgBKmZAhRv6cxpZ3l/l8/ZUtsgJcMjYo+Onx0nbL3CUbuqp0YQHwlpDQvJd8N/sC5cG8X/qgYdYKg2sZ9AoOE0Z4TjdXlIRhQbIGtogJdgOB/LuOqxFQFi/aMjD47VnxvCNobKpz+U13CkJqhVQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Per Bilse <Per.Bilse@xxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, "open list:X86 ENTRY CODE" <linux-kernel@xxxxxxxxxxxxxxx>, "moderated list:XEN HYPERVISOR INTERFACE" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 22 Jun 2023 13:05:48 +0000
  • Ironport-data: A9a23:aaeOIq7GQEeIdEReyD8t2AxRtDvHchMFZxGqfqrLsTDasY5as4F+v jQdXD3XPviOZWb8L4sibtnk9kNQ75KAmoNlHQBlpHtgHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9lU35JwehBtC5gZlPa4R5geE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5mp fNbDwIsfhC5juO13quKZLNjgsUxBZy+VG8fkikIITDxK98DGMiGZpqQoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OkUooiOKF3Nn9I7RmQe18mEqCq 32A1GP+GhwAb/SUyCaf82LqjejK9c/+cNtLT+XmraE32DV/wEQZGiNMVErmjsWIyV7hZu1ZM 3JP0DgH+P1aGEuDC4OVsweDiGaJohMGSfJRFeMg4Q2Aw6aS5ByWbkAGQSRGc8cOr9ItSHoh0 Vrht9f0GTtHs7CPT3+ZsLCOoluaJScRPUcGZCkZUREC5djz5o0+5jrKT9BsF4avg9H1EC22y DePxAA0n50aic8G0fX98V2vqz6luJWPTgcz/QjRdmak6B5pIo+je4Gsr1Pc6J5oPNbHZlqMp n4Jn46Z9u9mJZGVnQSfUfkKBvei4PPtGCbHnVdlEp0l9jKs032uZ4Zd5Hd5PkgBGsEAdDzya UnfozRN9YRTN3una6xwS4+pAsFsxq/lffzhV/bJfp9Nb4J3eQuv4i5jfwiT0nrrnUxqlrswU b+LfMDpAXsEBKBPyDutW/xbwbIt3jo5x27YWdb81RvP7FaFTHucSLNANUTUaOk8tfuAuF+Mq 4wZMNaWwRJCVuG4ejPQ7YMYMVENKz48GIzyrMtUMOWEJ2KKBV0cNhMY+pt5E6QNokifvr6gE q2VMqOA9GfCuA==
  • Ironport-hdrordr: A9a23:VDHAyqBMOa5stMHlHemr55DYdb4zR+YMi2TDtnoBLyC9F/bz+v xG88576faZslYssQgb9+xoW5PwJk80l6QFhLX5VI3KNGLbUQ2TXeJfBOPZrwEIcBeOktK1u5 0QEZSX17XLYmST6q7BkXCFL+o=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22/06/2023 9:26 am, Peter Zijlstra wrote:
> On Thu, Jun 22, 2023 at 07:22:53AM +0200, Juergen Gross wrote:
>
>> The hypercalls we are talking of are synchronous ones. They are running
>> in the context of the vcpu doing the call (like a syscall from userland is
>> running in the process context).
> (so time actually passes from the guest's pov?)

Yes.  And in principle it's wired into stolen time.

>> The hypervisor will return to guest context from time to time by modifying
>> the registers such that the guest will do the hypercall again with different
>> input values for the hypervisor, resulting in a proper continuation of the
>> hypercall processing.
> Eeeuw.. that's pretty terrible. And changing this isn't in the cards,
> like at all?
>
> That is, why isn't this whole thing written like:
>
>       for (;;) {
>               ret = hypercall(foo);
>               if (ret == -EAGAIN) {
>                       cond_resched();
>                       continue;
>               }
>               break;
>       }

No, because that would have required the original authors to write a
coherent interface.

As example, I present "long hypercall_get_dr(int reg);" which returns a
full %dr, or -EINVAL.  But other hypercalls have completely disjoint
API/ABIs so even if you could tell Xen not subtract %rip to repeat the
SYSCALL/etc instruction, you still don't have any kind of way to spot a
continuation.

Making a new ABI/API which looks like that is specifically on the cards,
in some copious free time.

~Andrew



 


Rackspace

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