From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D027DC433EF for ; Thu, 21 Jul 2022 15:26:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbiGUP0G (ORCPT ); Thu, 21 Jul 2022 11:26:06 -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-Google-Smtp-Source: AGRyM1s4jbrd+HHmsGjYZRgS2raRakVuaIBd48F8IPCNE2NUCnQugca4NB0SWzvboULXHumLt45VtQ== 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: 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().