Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp691487imi; Thu, 21 Jul 2022 09:05:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMnczkcw1DUyzCfTuatGOMiAmr/n30xZZZxs4c/syDEgAfaWTQObiEbchhpvT1fmf5+84F X-Received: by 2002:a05:6808:2025:b0:33a:affd:10e3 with SMTP id q37-20020a056808202500b0033aaffd10e3mr947378oiw.226.1658419546313; Thu, 21 Jul 2022 09:05:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658419546; cv=none; d=google.com; s=arc-20160816; b=L8gnACawDx8Hd/VuV6Il1feof1xYU0zs1OKPFcflFR6vJp2o9lzT2hNtkfJgFk6HwO gTV7jcPTXmFeloBpcc6AdtY3x59c30LRkFSICylCKvzSziLHYeKOYIC36ddp093XS0sU +HmmR4xtWTUoW0jLCh9N2QBJcvIOvXveUYbLP41DMwrS+yW3TEtaVgQwi03JSozeAphg Yh4IXGoDaKFCXNwjhYCSDu6D+qbOYPaBPu0wm+Q3xwIIaL1R6xacnvh3lZ5+O6m1K0zD HYnX+J2aIVGXwnGOrKSzt/uvgtEW6wQDvFfNGa6m6BDhgxgLQuh0I7qosNtwg3jH3W0p igJg== 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=2uLd/RvlCglp7VMJKG7TRwZBoXRuAQZML6wCn6y9QPE=; b=VhL5ObD/GcPZkA3rffo690xm5GfVXzWb1TH0vxFDh+KH3F5WIhsCfAbLCGUZZzWZMd d1crIAgdJlw3u7Y1k0ElihUQPakZ+eIySk6f9BQiZcSPREvrLDbnWgfHcCpaPH8QrMGy oWa+xT+6Tdt11jVmPkC7BunQFFVAcsDN0nYEmQMnBoQlaqM81yPjjAdEybmlv2rlw6Bc 11/OXvuc+3PqZaIk8D66lLdDofZHuMb0Ogu3/suITJDPbht1p76JIcCwAqgKhmegdYbj 34TC+pCQ1msfyJwDgAeE1At9ItvwOLjkhrROt26KWG1qHM3S0DeZWaKf/3tdlyOI6rcA eQQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=U8YeA1C1; 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 i7-20020a056870890700b000fdff6064a0si2521430oao.37.2022.07.21.09.05.14; Thu, 21 Jul 2022 09:05:46 -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=20210112 header.b=U8YeA1C1; 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 S231383AbiGUP0F (ORCPT + 99 others); Thu, 21 Jul 2022 11:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbiGUP0D (ORCPT ); Thu, 21 Jul 2022 11:26:03 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BCEF2124C for ; Thu, 21 Jul 2022 08:26:02 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id b7-20020a17090a12c700b001f20eb82a08so5582894pjg.3 for ; Thu, 21 Jul 2022 08:26:02 -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=2uLd/RvlCglp7VMJKG7TRwZBoXRuAQZML6wCn6y9QPE=; b=U8YeA1C1xSmyf9+g6oR8D+gFOIU4wx6tbOqYi/lXgRktJn50dwvUYwjs0cAk4xYSRZ NdVOITGtBt1888pnTJF12EhfFQp1ZjMYxPtt2twRkUFC5rAwA58kPIJeQ+XWL7tAEKLv PHhv4UmiLlB2FD5ZZwJ87M+5IJ2jbF6D9yGS94EUIXg8+3+enWUWO58q+DA4ghVcBfOf OXYwfAaGtYbxz316MH3az8hvm+PgGNDH4LueZl+QJPAnZy0hrPWIYLVHo1UCrES6RVqB zP4RHCzc9gDewTG9NDS3IDGMN2jzDS63hbyUZsWGGW4vnuNXk0JbbXHxQeNFRWhTBvo/ e97Q== 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=2uLd/RvlCglp7VMJKG7TRwZBoXRuAQZML6wCn6y9QPE=; b=HgqzwCXmHuz6ihNtLfl6OrjH/eF98FmCypcaG/c2TasaX1hm8jU0uIN2OLOyaYaRa6 S16vweqahyE53xVLkhJUpYCNDqojR7BKWcJlHhADp3eMrA1kx4H7+ZfeysuUztxsyfR8 vVnWmN9DLvJ6NIWgJwmEEMf2Wtf8mcbmSS7s/Z5AJitJs/Vp1cR1ByzqZKwAnOUaIDCt Sld97TC/Pn//gdmNlgX52A6c9A1qDTo0Nb+5xye/eXuejoghEimCJapoED3bHwFOZaFY 8QzdKJX+EzuS0Zd+5Tu2LUKsjwkh/Rrt2Fz2zfndkKutVVE4EGNQYwVNn+yHMHr2h+ui lZyw== X-Gm-Message-State: AJIora9/0ePlrZuYVMVt2ecr7QNyCd6g9/5hq1X4+vsUW0S8qkx0wN7C qqLoFPtGTn/4sZWeCfM/iJ5RQw== X-Received: by 2002:a17:90a:8914:b0:1dc:20c0:40f4 with SMTP id u20-20020a17090a891400b001dc20c040f4mr11806859pjn.11.1658417161366; Thu, 21 Jul 2022 08:26:01 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id q14-20020a170902a3ce00b001618b70dcc9sm1832358plb.101.2022.07.21.08.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 08:26:00 -0700 (PDT) Date: Thu, 21 Jul 2022 15:25:57 +0000 From: Sean Christopherson To: Lai Jiangshan Cc: LKML , "open list:KERNEL VIRTUAL MACHINE FOR MIPS (KVM/mips)" , Paolo Bonzini , Vitaly Kuznetsov , Maxim Levitsky , Lai Jiangshan Subject: Re: [PATCH 07/12] KVM: X86/MMU: Remove the useless struct mmu_page_path Message-ID: References: <20220605064342.309219-1-jiangshanlai@gmail.com> <20220605064342.309219-8-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=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 Thu, Jul 21, 2022, Lai Jiangshan wrote: > On Wed, Jul 20, 2022 at 4:15 AM Sean Christopherson wrote: > > > > Nit, s/useless/now-unused, or "no longer used". I associate "useless" in shortlogs > > as "this is pointless and always has been pointless", whereas "now-unused" > > is likely to be interpreted as "remove as it's no longer used after recent > > changes". > > > > Alternatively, can this patch be squashed with the patch that removes > > mmu_pages_clear_parents()? Yeah, it'll be a (much?) larger patch, but leaving > > dead code behind is arguably worse. > > Defined by the C-language and the machine, struct mmu_page_path is used > in for_each_sp() and the data is set and updated every iteration. > > It is not really dead code. I'm not talking about just "struct mmu_page_path", but also the pointless updates in for_each_sp(). And I think even if we're being super pedantic, it _is_ dead code because C99 allows the compiler to drop code that the compiler can prove has no side effects. I learned this the hard way by discovering that an asm() blob with an output constraint will be elided if the output isn't consumed and the asm() blob isn't tagged volatile. In the abstract machine, all expressions are evaluated as specified by the semantics. An actual implementation need not evaluate part of an expression if it can deduce that its value is not used and that no needed side effects are produced (including any caused by calling a function or accessing a volatile object) I don't see any advantage to separating this from mmu_pages_clear_parents(). It doesn't make the code any easier to review. I'd argue it does the opposite because it makes it harder to see that mmu_pages_clear_parents() was the only user, i.e. squashing this would provide further justification for dropping mmu_pages_clear_parents().