Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp287068rwo; Fri, 21 Jul 2023 11:51:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlHG1nowzBH2TODdJh1n0MrCixxThCiC95ziPdm+/v8RWqZGYyVMExhb4HMOYtVHHxYu+lnW X-Received: by 2002:aa7:d991:0:b0:521:d83e:8db2 with SMTP id u17-20020aa7d991000000b00521d83e8db2mr2088856eds.39.1689965519301; Fri, 21 Jul 2023 11:51:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689965519; cv=none; d=google.com; s=arc-20160816; b=JtMHtlTeSv3fQ/h9ASHJsEiGvhPxuOxLccpMwOuZrYK31lWlnA6WRW6qK/dVnoaOwo ZdoyDczl4jY0rhRpNj8/ZU7OoGxEdIPKtWamyex9itLpE5mhFq+8WNQIIBSNah95Bfuq NJp8cTgngSXjYSk0OmeK+u7Uu5PKipJFZ9t3VNYOPnwBxg3MU3qALhN8/23OG3fdZ9Zs CRTZtpEgZivi+Kh9pbSPTGpX5DQijoL0beRyLeixk5bkwJB7Yz3dklbBByPAeonZHtCO qjCUxIrbh+7xI3BPYW6jh45LOwmJiYFZNbteIul1/tGSPO64o3z+Om/EZyOMRnLo6kl2 zeNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:references:mime-version:in-reply-to:date:dkim-signature; bh=7DBmD+NWofmGocm5Vnh+WkykM6ONviwwjpnheMJOIK8=; fh=rA+Ko9v0V9Jfzej/2wEh1JRvK18On0jiMoTgR8zJcIE=; b=RJNOquN43SuNxiATqG7JVOl4UzNqkxY5WkKPlIs33xlaXTWMVviwIfj1Gb0MgOxYK2 DJd9TozGsmyXzPgIuiMIQveXECCrK2Fd2fJg96Focvq3hjO9KUOkcoW/S5qWHHlLMF3u Lsf2DpRJmz01HJ2jA1uuL03VWo3vuXwwnu1E9uQsULDZEuq13NDBQbI8uV6xSOdB/CZG U6mHne/F3FPorp4BQ1GI700DIo4JZgu3Xhp0LIAnLLbdn+C0VfWI7+yQgyDVPJ0j3vq5 uAF88rkUUIer2LHQHdEbjffYDCjrk8WTebseFg6JZJqom6vTKU8vE+j+qXoWnM5LYvi1 aP6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Kleh8Qps; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020aa7c14e000000b005187aee0b5esi2892409edp.396.2023.07.21.11.51.35; Fri, 21 Jul 2023 11:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Kleh8Qps; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230148AbjGURnK (ORCPT + 99 others); Fri, 21 Jul 2023 13:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbjGURnF (ORCPT ); Fri, 21 Jul 2023 13:43:05 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93DAD3580 for ; Fri, 21 Jul 2023 10:43:00 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d064a458dd5so363001276.1 for ; Fri, 21 Jul 2023 10:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689961380; x=1690566180; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=7DBmD+NWofmGocm5Vnh+WkykM6ONviwwjpnheMJOIK8=; b=Kleh8QpsTsNUhesVcFKaorRemH2b7oCPrjs/EZvvDbSIhnU646cwazqZifDUNyxi+Q 5JqV9CUAW8QaG2YIfQCin1qnHve1MgXICSxbyDPLV8MjQRP2Kpasi9pL5sbB8O7UYjBa jgRp3U3UDnkkD6e19TR7wMGjHPVEilwKuPvhlll1BPS6C8DVpWehyFU2WczctGneBM1v 8h/JnmhFLy8tlfXVq6NzVrFmSK26MkEiOaRidvtVK6eqi9qhd/VP0gDfCAxADqhE52gi 5Uc2vJ9HkSFyp91F1M5r9W96Us+3KtG0sWvhTTO0jFsQ1GbEx81tOU6Kjmmi3SIi/0Fk yy7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689961380; x=1690566180; h=content-transfer-encoding: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=7DBmD+NWofmGocm5Vnh+WkykM6ONviwwjpnheMJOIK8=; b=dPjcM8xDf6w8XDWXVK5cNJRHoWFl4pTN7r2s5pJmRCXLgzBp5n9zFuzK6L6mjW/qrD TcJ9LWvfjs00+iBwoMEKHXsJKkaG7FnqrgNk5HmBF2OFiLhe3xwsRh3dTGnot37BEoSc fWmAQUN+yCYSZDGfUnCYt1fQbMR9knhzM+XDD/nIjbPy0Y7OZnNXuhFHdNjljQtVM7iA /Pmveh/5MbH3VasP6AI+dGlrG+f03uyLXpiAY53uX1Xp/dBKJqKoqh6xrqo+6WwGFbCS +TMpp0B2TFT8C9tcy2A+WrwkRsscOKuR5gdZEWtXvxwz90NbBCWCXs0AIONihfT0eg/l 1/1A== X-Gm-Message-State: ABy/qLYz14EjVRKIT4cJJAK9yTjCuoFqVUKyBlKOy7thpReM4PcMRMIv JvtXt+tIEhrShIJ7j058b59XskG60Rw= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:10cd:b0:c1c:df23:44ee with SMTP id w13-20020a05690210cd00b00c1cdf2344eemr19665ybu.0.1689961379855; Fri, 21 Jul 2023 10:42:59 -0700 (PDT) Date: Fri, 21 Jul 2023 10:42:58 -0700 In-Reply-To: <29baac45-7736-a28c-3b2d-2a6e45171b8b@intel.com> Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> <20230718234512.1690985-13-seanjc@google.com> <29baac45-7736-a28c-3b2d-2a6e45171b8b@intel.com> Message-ID: Subject: Re: [RFC PATCH v11 12/29] KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory From: Sean Christopherson To: Xiaoyao Li Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=ham 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 On Fri, Jul 21, 2023, Xiaoyao Li wrote: > On 7/21/2023 11:05 PM, Xiaoyao Li wrote: > > On 7/19/2023 7:44 AM, Sean Christopherson wrote: > > > @@ -6255,12 +6298,17 @@ int kvm_init(unsigned vcpu_size, unsigned > > > vcpu_align, struct module *module) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (r) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto err_async= _pf; > > > +=C2=A0=C2=A0=C2=A0 r =3D kvm_gmem_init(); > > > +=C2=A0=C2=A0=C2=A0 if (r) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 goto err_gmem; > > > + > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kvm_chardev_ops.owner =3D module; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kvm_preempt_ops.sched_in =3D kvm_sched= _in; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kvm_preempt_ops.sched_out =3D kvm_sche= d_out; > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kvm_init_debug(); > > > +=C2=A0=C2=A0=C2=A0 kvm_gmem_init(); > >=20 > > why kvm_gmem_init() needs to be called again? by mistake? >=20 > I'm sure it's a mistake. Yeah, definitely a bug. > I'm testing the gmem QEMU with this series. SW_PROTECTED_VM gets stuck in= a > loop in early OVMF code due to two shared page of OVMF get zapped and > re-mapped infinitely. Removing the second call of kvm_gmem_init() can sol= ve > the issue, though I'm not sure about the reason. Not worth investigating unless you want to satiate your curiosity :-)