Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1223316pxy; Fri, 23 Apr 2021 03:17:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhQbl5kFhMRyBoWxapPabxsRMrtko2J3VVX8QNvh5qBIgEtdJ1K0vTU8e6i9IpEqAMmrxW X-Received: by 2002:a17:90a:f303:: with SMTP id ca3mr4913898pjb.145.1619173069939; Fri, 23 Apr 2021 03:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619173069; cv=none; d=google.com; s=arc-20160816; b=FoI0frfKv2fqFdVw9Q62//aDexBk/A3HFbwNdDyEYt4iTEFo4wpd/asJPW9x83qzQ8 5EU15WwYufOfNG4WN1wqQSIcASNxdbH/gMBs9FawEJU/nPW3E0PLn7rixNpJEQxSwBZ1 Exidy7eazpPthmn+pGJRswvbv+B/Qboop8VrgZBhEGGhpL0R4eRHZz64bWmSQjBO7PEc YUcUEmashivncFCClZlm5kVS+k1XXmosilGpHpu6y+fXLU4UZvCWPUxm/+GoWgSDb0sn ZG3bAQAtKUCwcV7NQvYWg4mZAaOE37cT9++YM+BMlFQrt/2vTdpTnnAI6j9FXKjVVi3u +SAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=zU8xSHS0eLUV311ziEBewDcU/XJ05AOBQVWlp6b2OZI=; b=wA9xBg6KMSgiktc/JSupv1QK1Q8ZgKOLl5xjvS7AVqbtKq9Wkrflgmg3ydLOm2YReT gcu8N9UoIJMpRw/sPu5sh3gET7cpXx3ta75QkUWohBNnBzeYX1tMd1D904WOmQzXNtGY s/xYd3/KW80i+dHpVhpTvDuHiAsAQkcTBip4QqQq2PGA/jQ/XGucPEJd7/hI742t4riI JptWsWVsvflV/LRWMWT53TvI4+qXDxx+/S0P0PZjw/+dsC9YFjQH0dopuyCgjSJ65gV0 YsJUqsUFNu9hVjv1q0Ji06gL4BwU17ONsfVgNE0s7kx3pzwdcN9pBHlwOi1NgC+qw8P5 urQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hayLeO+e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n24si5999857pjq.168.2021.04.23.03.17.36; Fri, 23 Apr 2021 03:17:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hayLeO+e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241973AbhDWKPq (ORCPT + 99 others); Fri, 23 Apr 2021 06:15:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24968 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241898AbhDWKPp (ORCPT ); Fri, 23 Apr 2021 06:15:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619172908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zU8xSHS0eLUV311ziEBewDcU/XJ05AOBQVWlp6b2OZI=; b=hayLeO+e7zNk0TeNBC482wcjdHRU3ihciBASZzDM5gQYewwKU301diW9dvyUuA+aQ23sFj xafp3FpJr+BAz1iueldYjJJEOtXjkTjM1eim1JgCGKvzb57wKW+Ro7DvF1NnzCw1H/b/0F L8txBcxNS1vJ4PZ2cLmMCsM+eqHSdto= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-191-zQXPCaAGPCCcndmlzyCZ9Q-1; Fri, 23 Apr 2021 06:15:06 -0400 X-MC-Unique: zQXPCaAGPCCcndmlzyCZ9Q-1 Received: by mail-ed1-f72.google.com with SMTP id y10-20020a50f1ca0000b0290382d654f75eso18343067edl.1 for ; Fri, 23 Apr 2021 03:15:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zU8xSHS0eLUV311ziEBewDcU/XJ05AOBQVWlp6b2OZI=; b=JggpHQjgsG6iLoRzKDfmW0n2qsW/8boOoZEDEV8Awk5C4xryns2yMULYkkjYtXVXbb S4RNFmsw35JJs8o4+CLVlcclpYeJ1Y+eO9VyZk5tkf9E/BX5eqBKnDT/4dYZIYmKLOK1 c7ifyuEHFegBMu7kU64tZD9uQHLoJuGUP8Fxlo70L1MOh4p7BzmLG/9FmJuIiElClGXy XZVsakCw3l25HpFnIM0ksyqF/26qbqzzp2thMQEz6MDHMwGBi3YTs3fghvXjmCUa/ZrE KWfhzarQky+ZR/kR+H0xuD5avQu3Kg9xZZGVWxi4Ww2ox53ENguA7N5/5vcCELsrAL18 TbHg== X-Gm-Message-State: AOAM5304j9SIzxOu5FrKukkkWRs6p8J058xqIcE06juMDShKiUgT+vfd /g8YhX2RuFU/445CCfY4Sk/95G0Spu8K/qLZhNfR0CoarF3GZOxaUJe0dwlAAkoZeI+qUswvtI7 qlMBcwlJFo2yaWkbNBrPC/UewzWZkW9npg6yiODHFkDRij6v4Gk5cG1xA76WqVdb42sMA3fhzr5 E1 X-Received: by 2002:a17:906:1c83:: with SMTP id g3mr3431453ejh.93.1619172904539; Fri, 23 Apr 2021 03:15:04 -0700 (PDT) X-Received: by 2002:a17:906:1c83:: with SMTP id g3mr3431406ejh.93.1619172904194; Fri, 23 Apr 2021 03:15:04 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id p13sm3685996ejr.87.2021.04.23.03.15.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Apr 2021 03:15:03 -0700 (PDT) To: Alexander Graf , Siddharth Chandrasekaran , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Cc: Evgeny Iakovlev , Liran Alon , Ioannis Aslanidis , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210423090333.21910-1-sidcha@amazon.de> <224d266e-aea3-3b4b-ec25-7bb120c4d98a@amazon.com> <213887af-78b8-03ad-b3f9-c2194cb27b13@redhat.com> From: Paolo Bonzini Subject: Re: [PATCH] KVM: hyper-v: Add new exit reason HYPERV_OVERLAY Message-ID: <45888d26-89d2-dba6-41cb-de2d58cd5345@redhat.com> Date: Fri, 23 Apr 2021 12:15:01 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/04/21 11:58, Alexander Graf wrote: >> In theory userspace doesn't know how KVM wishes to implement the >> hypercall page, especially if Xen hypercalls are enabled as well. > > I'm not sure I agree with that sentiment :). User space is the one that > sets the xen compat mode. All we need to do is declare the ORing as part > of the KVM ABI. Which we effectively are doing already, because it's > part of the ABI to the guest, no? Good point. But it may change in the future based on KVM_ENABLE_CAP or whatever, and duplicating code between userspace and kernel is ugly. We already have too many unwritten conventions around CPUID, MSRs, get/set state ioctls, etc. That said, this definitely tilts the balance against adding an ioctl to write the hypercall page contents. Userspace can either use the KVM_SET_MSR or assemble it on its own, and one of the two should be okay. Paolo >> >> But userspace has two plausible ways to get the page contents: >> >> 1) add a ioctl to write the hypercall page contents to an arbitrary >> userspace address >> >> 2) after userspace updates the memslots to add the overlay page at the >> right place, use KVM_SET_MSR from userspace (which won't be filtered >> because it's host initiated) >> >> The second has the advantage of not needing any new code at all, but >> it's a bit more ugly. > > The more of all of that hyper-v code we can have live in user space, the > happier I am :).