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

Re: [RFC PATCH 1/1] xen: Use a global mapping for runstate

  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 29 May 2020 09:18:42 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-SenderADCheck; bh=iGD1SjqY/6jwHOi5VOo/3XKg6aWSbbIKOPJKUtL0VVs=; b=Y9uif/bwriynOYJ9CLbGb1RPIFHVtN5tCQ+SDHTUVFf0WWxknXHnDJG7o9rh2DJ+B1xPN6XP4Nf99UxYsct84KA6niXnVNAE+GoQgOdM9tpHX6YUt1OGqFjVIZi9ZoYqYg9A0vfJIVMWt4O/TPl2IBUZJLM55Dd6Tq8qQ+cM8D6Ka+lhRCKUTNGaNMELSg3+GX+9sr5ns9a4LZe/eGH0syQeOTs1uwZIFlCNxsxcUQTX0GU2RsmXghCJlrS6QYzakiDWfUeCnJLd2kGgivHkWiK+IMhlc3x7e0YVP7WSiNvd38UaFM8YIpUaYAM5kBR1LIC3JtqLVuPLPU93gW24jA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZAkIfupaHfSZ91GnZFva5MF57dSkNfcj+OH22S08Mo85DYWQdg5LPHFrjA4uO6T0xVKtXUtJl+F4tzezjF5sMoY+o/FE39ckP1TLXA5OhEVcW3No2Uvdqj5WhrUEk3HAUmvVJpUkV40XgpbGl5WVbkb4dKd3OTw0KbfYMnRgYFbR2Zp78RsNhUCyKdCnnxO+MWSAi9mSCyTPbBQZTLP0J6ApdVxyIQJXbmJ4eX69crIM7Znbz0yZKzsg4h3vxWLg0R6i+F7abEuUgkE3YxQ60YPhrpUyZKi3iyUhvyTof6dpK2R/YEyfXshQwE8ZmR4szJMcKjiZ47zXeyR9W9kmCA==
  • Authentication-results-original: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Xia, Hongyan" <hongyxia@xxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 29 May 2020 09:19:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHWNP6nIxIB/r3XC025DLnqIbmaJai92N6AgADfWQCAAAi2gIAACV6A
  • Thread-topic: [RFC PATCH 1/1] xen: Use a global mapping for runstate

Hi Jan,

> On 29 May 2020, at 09:45, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> On 29.05.2020 10:13, Bertrand Marquis wrote:
>>> On 28 May 2020, at 19:54, Julien Grall <julien@xxxxxxx> wrote:
>>> AFAICT, there is no restriction on when the runstate hypercall can be 
>>> called. So this can even be called before the vCPU is brought up.
>> I understand the remark but it still feels very weird to allow an invalid 
>> address in an hypercall.
>> Wouldn’t we have a lot of potential issues accepting an address that we 
>> cannot check ?
> I don't think so: The hypervisor uses copy_to_guest() to protect
> itself from the addresses to be invalid at the time of copying.
> If the guest doesn't make sure they're valid at that time, it
> simply won't get the information (perhaps until Xen's next
> attempt to copy it out).
> You may want to take a look at the x86 side of this (also the
> vCPU time updating): Due to the way x86-64 PV guests work, the
> address may legitimately be unmapped at the time Xen wants to
> copy it, when the vCPU is currently executing guest user mode
> code. In such a case the copy gets retried the next time the
> guest transitions from user to kernel mode (which involves a
> page table change).

If I understand everything correctly runstate is updated only if there is
a context switch in xen while the guest is running in kernel mode and
if the address is mapped at that time.

So this is a best effort in Xen and the guest cannot really rely on the
runstate information (as it might not be up to date).
Could this have impacts somehow if this is used for scheduling ?

In the end the only accepted trade off would be to:
- reduce error verbosity and just ignore it
- introduce a new system call using a physical address
  -> Using a virtual address with restrictions sounds very complex
  to document (current core, no remapping).

But it feels like having only one hypercall using guest physical addresses
would not really be logic and this kind of change should be made across
all hypercalls if it is done.



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