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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C307C433E0 for ; Fri, 12 Mar 2021 16:36:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0606B64FE2 for ; Fri, 12 Mar 2021 16:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbhCLQfm (ORCPT ); Fri, 12 Mar 2021 11:35:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232506AbhCLQfd (ORCPT ); Fri, 12 Mar 2021 11:35:33 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 205D2C061574 for ; Fri, 12 Mar 2021 08:35:32 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id a22-20020a17090aa516b02900c1215e9b33so10981689pjq.5 for ; Fri, 12 Mar 2021 08:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=M1oLZJqjtjwriizT550dV/7keuNI0itwOyJW5hn/1TE=; b=YTqBDZIhkQErgpRLDruA3lP9/gm2v8Qn0iE5L6hMzg8tMD/nd48sg2lBf23FoveqNe HDQi3Hl1lMVHUKqZXwGWRgIUPkHc0J6+qa0ltdv56aZHsDAIJEEewqMbm0O+H14t2gtv 1LJZofXL9gnCePFSuQJHttqNqT52+DpFt+5s5zgBAP87R2mgUr6mt9BaV+HA3rXiEPRC oCRcam9d2oXPyYOOelSFqpjvZLYwHl8qLUgntLR1uQRS6iU4X3jY168c49pkEsIInr5e T3gf/O+y7orlUEGOOZxfCn961VFqEAe9PzBwGQUg0JwzbbyYpzqpFqMZVvDP0/NKDHMl T7hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=M1oLZJqjtjwriizT550dV/7keuNI0itwOyJW5hn/1TE=; b=pTYMLXrrrXgEoejqixma+Z6c+0p0Npt30oWcqZ3UyxndFnve7fOm1DTIpTa7J7pi1F tZV7dghnI9MhIwAOWqrRdsCN3AGegjgi1tuBX16NcSLHLDnJOcZ6e/5KDkH7UdJ34nzs HsLt0+wFdZDH6jTzOdSeMUzrPuJnNAMv3JY5qPm4Azeg+YHVz3UrJFHP3+Qahlh+9Hvl rpO0IekskQea9j5/iglvO9nyW9sr2Av+UEBC/gGJWRmNwIIiWYo3GLaiq/YYxGOlHMSR R6IXrgLMXoe4sXiKdOraTCkYp2lLxSEwRqc6V25mNTRmOPkfkqNsqFMUkDw6RaiF7gPy ASdg== X-Gm-Message-State: AOAM533eF+VO2iao4JGIb/ozSzT+QMdzZbbMPELFcKsI9zA5bKd/b2/5 ivIX+H6bfb57QweUa+QDFse9TA== X-Google-Smtp-Source: ABdhPJxheV+DKT6kR8vMi7FN/wSbPyRX3UcrIbZenKRHnBu/7oIdrg89nNYJ/BWwNrTukQUvMyOYFg== X-Received: by 2002:a17:90a:516:: with SMTP id h22mr14325622pjh.222.1615566931518; Fri, 12 Mar 2021 08:35:31 -0800 (PST) Received: from google.com ([2620:15c:f:10:e1a6:2eeb:4e45:756]) by smtp.gmail.com with ESMTPSA id h23sm5971681pfn.118.2021.03.12.08.35.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Mar 2021 08:35:30 -0800 (PST) Date: Fri, 12 Mar 2021 08:35:24 -0800 From: Sean Christopherson To: Ben Gardon Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Peter Shier , Jim Mattson Subject: Re: [PATCH 4/4] KVM: x86/mmu: Factor out tdp_iter_return_to_root Message-ID: References: <20210311231658.1243953-1-bgardon@google.com> <20210311231658.1243953-5-bgardon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210311231658.1243953-5-bgardon@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 11, 2021, Ben Gardon wrote: > In tdp_mmu_iter_cond_resched there is a call to tdp_iter_start which > causes the iterator to continue its walk over the paging structure from > the root. This is needed after a yield as paging structure could have > been freed in the interim. > > The tdp_iter_start call is not very clear and something of a hack. It > requires exposing tdp_iter fields not used elsewhere in tdp_mmu.c and > the effect is not obvious from the function name. Factor a more aptly > named function out of tdp_iter_start and call it from > tdp_mmu_iter_cond_resched and tdp_iter_start. What about calling it tdp_iter_restart()? Or tdp_iter_resume()? Or something like tdp_iter_restart_at_next() if we want it to give a hint that the next_last thing is where it restarts. I think I like tdp_iter_restart() the best. It'd be easy enough to add a function comment clarifying from where it restarts, and IMO the resulting code in tdp_mmu_iter_cond_resched() is the most intutive, e.g. it makes it very clear that the walk is being restarted in some capacity after yielding.