Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1215276rdb; Fri, 1 Dec 2023 09:47:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlgvZcqIcZ1aIC5KuDiOTNOXU+PCB9ifeE2FtNutYlDUQC2pL0SzDues+eD6hQ9TGwPifM X-Received: by 2002:a17:90b:4a09:b0:27f:f61c:327d with SMTP id kk9-20020a17090b4a0900b0027ff61c327dmr26061860pjb.0.1701452842980; Fri, 01 Dec 2023 09:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701452842; cv=none; d=google.com; s=arc-20160816; b=oN8I6O8eVfCTDkeVNEflCZ2Qhvu/TfRJHBQStdIC55wdL9h936cBZDQX/JlfsntBEC DXc4whkp2ebVS2PKYZ+AwYvxQdOJ5chzNjqKQmmgEcIcl5IpMxqRnBVDTq10id0quTNX SAYCzv5FVR2gAPCJLB/2jVfABL4hDFD1i4Hf4Gnz2y3HE0xCwMOJrI8eLfE6CEAhan7h OM9SdvGKVVLwjUGxQpCqHpJInFW3r+qgDEPYooaYspontAnMZhJ5OMKeLXJ6J0EDKCR5 +s/FglBGD37cj4+CKvGi/7qBve9D64YLoHaIW0CGwktVbSeAPXWvPbiAD3InskhiwWM5 QjzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=ekY0qH1P2v7sxet+FFzSNmfvdCHeSDMjAlh064D7O84=; fh=m2/an6Yyko+exqcDfP9KRKoiB1bRu/g2MD8GKDJfbmc=; b=hkbGqOl8VrJci3Z0/2RWkXUR7upV1/w3bWVWs/svpia75yFkP1ECcSAJQHFmq5CmVY KoJ6rKEk4lQpfkjv9oZfm3k7xKmtT6y0dK60QHCCb3vGoBui1r823E554FmdtKS+JigK T/LQbIaG+K3NM9pg8ZOW1de1+1bGTsPhTXYHzKUSe/dFkl4C0xL54WkjpliL4SCWB+yD IL6FeF0UAI1xOYoVdVQ5plutvTmS136RbWUuVJn/jZitIVhRzckN0Xm/z4JT3M2TyV0F IvnvdWaw/Pr2ResHTUnijpXj1iiNl33hbS/cIzlYd//9Gmuy3GTO99CDHa/RewnM0hjU R7AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2Yuf4U0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ft2-20020a17090b0f8200b00285b8d3830dsi3692029pjb.160.2023.12.01.09.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 09:47:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=2Yuf4U0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BEE9480E073B; Fri, 1 Dec 2023 09:47:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378938AbjLARrM (ORCPT + 99 others); Fri, 1 Dec 2023 12:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjLARrL (ORCPT ); Fri, 1 Dec 2023 12:47:11 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDD329D for ; Fri, 1 Dec 2023 09:47:17 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5d6b751dabcso7623527b3.1 for ; Fri, 01 Dec 2023 09:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1701452837; x=1702057637; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ekY0qH1P2v7sxet+FFzSNmfvdCHeSDMjAlh064D7O84=; b=2Yuf4U0y/otd79jj1rlpstx914BdJ+x9EcIqpsRmKvrq9Y07Bb/mM+8dAKhOhy9G+T s94snDmQuAmGp8uovCeVwZU1orBfArvFzOHGfCJOhiit3CZYaQJdOKkcYxFO6Basfbeb 5/siLSTEoTu2ovxOBzkm2qxvwmKq75uPvi/y7R0Jek40T+U9a2lWq/USiT6lsp3VBGJg cX5Ua8fvyaczOhAGtaGuOLtkNnH54EHO5PsMW7D9L7Vi7At6MdATt/KW6Y3QwzN5TepV Rf35ObflW5Y2qybNwhlggO3tQMYhjAlrVT0SEzYofJ2qXwLNeX95g8MHRLJb9Bo3Uny9 9pwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701452837; x=1702057637; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ekY0qH1P2v7sxet+FFzSNmfvdCHeSDMjAlh064D7O84=; b=QqgamOOlJZz731Mf5TikQj4h7R5GqINmpFjF8tnFlSljdDuwHJwwxZo/agx296nOVM nREVBcRtzsG4+HMx3LW4m3ffOKq36U//HDvP5iYjzd7lmvm6O2HOtKuDDuLjJuWwl2fy 8CGCGi+3xI/oZPwVqnFiR9SM9OxJn2nYj/TqxGFy84R8EP5SerB4Iy2JQ2jVcCd4Ep6L +BygUzJABPvW9+NswzuGnKEgbgYmjvEJNiypxYARhYUPPw1kCDHm89oVC77dSpkZLxE0 8l1459qDpVwbA01I/irqbUTD7PHRrGbzrpAJByIhhFmu3CauDK0xmSPizpxyZYgLuEsw HVkg== X-Gm-Message-State: AOJu0YwKieMtv+TCdSrhAyhLyLySO8t1hIG6Iurb2j/gLBm4aJrHvfOy Dc4FktzZ9tB49bcqtiSwcjVPHCB4MEU= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:690c:98d:b0:5d6:cb62:4793 with SMTP id ce13-20020a05690c098d00b005d6cb624793mr36113ywb.0.1701452837094; Fri, 01 Dec 2023 09:47:17 -0800 (PST) Date: Fri, 1 Dec 2023 09:47:15 -0800 In-Reply-To: Mime-Version: 1.0 References: <20231108111806.92604-1-nsaenz@amazon.com> <20231108111806.92604-6-nsaenz@amazon.com> Message-ID: Subject: Re: [RFC 05/33] KVM: x86: hyper-v: Introduce VTL call/return prologues in hypercall page From: Sean Christopherson To: Nicolas Saenz Julienne Cc: Maxim Levitsky , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, pbonzini@redhat.com, vkuznets@redhat.com, anelkz@amazon.com, graf@amazon.com, dwmw@amazon.co.uk, jgowans@amazon.com, kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, x86@kernel.org, linux-doc@vger.kernel.org Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 09:47:21 -0800 (PST) On Fri, Dec 01, 2023, Nicolas Saenz Julienne wrote: > On Fri Dec 1, 2023 at 4:32 PM UTC, Sean Christopherson wrote: > > On Fri, Dec 01, 2023, Nicolas Saenz Julienne wrote: > > > > To support this I think that we can add a userspace msr filter on the HV_X64_MSR_HYPERCALL, > > > > although I am not 100% sure if a userspace msr filter overrides the in-kernel msr handling. > > > > > > I thought about it at the time. It's not that simple though, we should > > > still let KVM set the hypercall bytecode, and other quirks like the Xen > > > one. > > > > Yeah, that Xen quirk is quite the killer. > > > > Can you provide pseudo-assembly for what the final page is supposed to look like? > > I'm struggling mightily to understand what this is actually trying to do. > > I'll make it as simple as possible (diregard 32bit support and that xen > exists): > > vmcall <- Offset 0, regular Hyper-V hypercalls enter here > ret > mov rax,rcx <- VTL call hypercall enters here I'm missing who/what defines "here" though. What generates the CALL that points at this exact offset? If the exact offset is dictated in the TLFS, then aren't we screwed with the whole Xen quirk, which inserts 5 bytes before that first VMCALL?