Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp2000624lfo; Sat, 28 May 2022 13:21:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH/L7q9GZA9uY7LmZHmE7fpRut2b+3UvSvLR7tescN7ev4lukMRCb4RNuS51uV68dzivi3 X-Received: by 2002:a17:90a:1b84:b0:1e0:493a:425c with SMTP id w4-20020a17090a1b8400b001e0493a425cmr14850734pjc.200.1653769275772; Sat, 28 May 2022 13:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653769275; cv=none; d=google.com; s=arc-20160816; b=ycgC8wNncq+Pbp5W1ZecLxH0181IUeyGFjbRxmjyqR+DbU4FagI15rxf8IxS07Jj0a jA10/oGH2LG1VEF9/2uQmeXpqC1xsuDeHrkERDQh5UeTrRl/35JJEB133jCUhTP7WoZQ ydtzo6i4IlsPB0BwycohPVwBWT3YmUmO1ebcNT9g57yot3Y6uu46aMqeKFKLD25Ux4Zg /HBFCBPOc1iuU9KwqgzPnQQWsIM3uKn5KDbHSOEHRVZdzT4x/kwIowXwwdXLr60ifdYL Y6aPPrfyr7+rltusjq+VTw53SGozzn2x1oJLMXIbcGeoaR3jxfdabXclMye1Kh8BiGbt 4ZZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hK3ULfxu4d3bVNXhOv+N4/y59AUq5R7yu3MMv9k/2+w=; b=jSLWFgtxoAwmcq3aG+zpXbLPxsUhJFiQDPNjtalAzy+/a2ZgXZDJYQOSno+IgB5BVN 4etvNh2aX40dYQ2I1+Sw2w+qfWbRXbGNy/IvJOnObORZYpJMx83SKEYlEUu4MlhuK1c/ zwz+9xz4GfqfxnbgpfN5EESda9IKdflZc0r7tUJmA6RpDOKdfeGsvkFwVBSPuvK1QV2C bXg/ZN4GjSwD8dnuDtcaX+6LEkGG9euFhAgB2EOrydx+D0fgcnZEZfSJpU7PtFB/8yjI B+96H3nIu7i6UF2fQesNN3i96Kjo+PJgMX3rcSu1R0k9XbVj9MO63dc29q8fKDCn8jcI Sjag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rLcLmqKb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id be3-20020a170902aa0300b00158d6f07b2esi10441172plb.85.2022.05.28.13.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:21:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rLcLmqKb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 60757175688; Sat, 28 May 2022 12:32:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348915AbiEZU1K (ORCPT + 99 others); Thu, 26 May 2022 16:27:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235459AbiEZU1I (ORCPT ); Thu, 26 May 2022 16:27:08 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1CAFCE09 for ; Thu, 26 May 2022 13:27:07 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id h13so2601135pfq.5 for ; Thu, 26 May 2022 13:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hK3ULfxu4d3bVNXhOv+N4/y59AUq5R7yu3MMv9k/2+w=; b=rLcLmqKbwp35p4AGCIm1BGwOrP2oLLcybaOH1Zq3/w9p2VR9DsW3uFdyGG2uiAcYyd zDM9obr9y7aPhXr1vH+xbOrE7kCAvOJ/ldMBFZakTuwmBuoGD8JA9+nzZio+cVl7gdmn 9Oz3LeJk35Yj1vPhqtF+OsMqbMP7M8OQGyyyXmqqlAvIugAbjEzGQAUxf1oIHa6bpKTc iNAcMxy1emu9Cy9yd+u4RnfT4kqGEqOQ+78N1EiVXK+5qBTx7JnOuqCY/Bc3VsSrgLp8 /haJm3eCrPxTo9GDFB3a+oDALWpNaj8r/k+jAq8wEkpbFYRGYA+9zFLH5KgXOgLYN25N BuAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hK3ULfxu4d3bVNXhOv+N4/y59AUq5R7yu3MMv9k/2+w=; b=OQTU9SytiAcT850EBlPc7SddtdwbNIR5Mh6wyAN4LujrJ/auTdrAca6eyyZvcfGC1I 8PTRFb83D+dXMx6PF5b2GWgZvpuEYO0MhZeRZtV35A8PROonqo2SVKIqErin6lBM5U+2 93UA/e542FfTnfOCzfaWYcTgAqcRBlcJR0z/w6df+SkQHP3dycZUusz7ljFdfO6qg0ZU zV2IwectE+KRgYLJVSNvdy5YhLykMqxohLa63pEdZRlgM8JF3ubtWmxyQLhXVZ+pEaod yskqhnNjnCuXe0lmB25ahNk4hBRF/8uOhAqlf3nVYpwL/iGFManSG51+UJpE6sSp8Rtx UTpw== X-Gm-Message-State: AOAM532AyHGnDZtZ++Dh6DPsLzUXnzvjNs3/7mb6OlG3G8mNR8OnPzNx KTSHpUBipLbFnIMFnYIYlPXWCiy6JIJzzQ== X-Received: by 2002:a63:8aca:0:b0:3f9:f9ed:7426 with SMTP id y193-20020a638aca000000b003f9f9ed7426mr23416520pgd.176.1653596827205; Thu, 26 May 2022 13:27:07 -0700 (PDT) Received: from google.com (254.80.82.34.bc.googleusercontent.com. [34.82.80.254]) by smtp.gmail.com with ESMTPSA id l24-20020a17090aaa9800b001e0c1044ceasm55740pjq.43.2022.05.26.13.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 13:27:06 -0700 (PDT) Date: Thu, 26 May 2022 20:27:02 +0000 From: David Matlack To: Lai Jiangshan Cc: LKML , "open list:KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)" , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Maxim Levitsky , Lai Jiangshan Subject: Re: [PATCH V3 00/12] KVM: X86/MMU: Use one-off local shadow page for special roots Message-ID: References: <20220521131700.3661-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 Thu, May 26, 2022 at 04:49:09PM +0800, Lai Jiangshan wrote: > On Sat, May 21, 2022 at 9:16 PM Lai Jiangshan wrote: > > > > From: Lai Jiangshan > > > > Current code uses mmu->pae_root, mmu->pml4_root, and mmu->pml5_root to > > setup special roots. The initialization code is complex and the roots > > are not associated with struct kvm_mmu_page which causes the code more > > complex. > > > > So add new local shadow pages to simplify it. > > > > The local shadow pages are associated with struct kvm_mmu_page and > > VCPU-local. > > > > The local shadow pages are created and freed when the roots are > > changed (or one-off) which can be optimized but not in the patchset > > since the re-creating is light way (in normal case only the struct > > kvm_mmu_page needs to be re-allocated and sp->spt doens't, because > > it is likely to be mmu->pae_root) > > > > The patchset also fixes a possible bug described in: > > https://lore.kernel.org/lkml/20220415103414.86555-1-jiangshanlai@gmail.com/ > > as patch1. > > > > Ping and please ignore patch1 and patch9. It would not cause any conflict > without patch1 and patch9 if both are ignored together. > > The fix is wrong (see new discussion in the above link). So the possible > correct fix will not have any conflict with this patchset of one-off > local shadow page. I don't want to add extra stuff in this patchset > anymore. Yeah I agree with splitting this fix out to a separate patchset, and ordered after this cleanup so it can be done in one patch. When you get around to it, can you also implement a kvm-unit-test to demonstrate the bug? It would be good to have a regression test. > > Thanks > Lai