Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7797271rwb; Tue, 6 Dec 2022 09:59:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Pm858dMJXPrYwklL5VIHm4uv7mtqBkV6OS60+svI6vyYGWIe95MaMXr69Bl7QOmLPS8iw X-Received: by 2002:a17:90b:710:b0:20a:2547:907 with SMTP id s16-20020a17090b071000b0020a25470907mr102703174pjz.37.1670349587234; Tue, 06 Dec 2022 09:59:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670349587; cv=none; d=google.com; s=arc-20160816; b=ihoacJ39tNdGhSaKlG4ISkTjRJV8e6CR1Q5juqtSz6AIy2gw335fb/1sUNJdhpcoNs TUP3te0L1reFceyr+ZV6JtHcJ6t2oiCg/Y2mgPcTczl8dUzhoSYmcFpXTOc5vV4JYtpP FjZg59t35aUZ2BspcMcuE/UgPBfNNlSEjfq0Qeq5GCIqGLyVjJsYexvelRQs71D3l8Mk 0FJJv1U+/n16VOdWZYJxBTIKJ7amNllvOZR3xKtEEpOLOUPmxrswsXn/43u37pv1lAuH X4vsZgKt5pTaF1ycBWXmMWr5jGQ/IhcTE55svjuhylTCZ1+K7M5Et2zqQylQMafTEOSl OXCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=qDEmCeemZEhSqKDixoru92cxFOmUueLA1+as4+4wo7A=; b=vW91pdGMZFV2ya+zLyfgchqcMHbxbrwxCkuAg8H/mKuLxohDmZ8Y5yVPgkQ2gBBXPB JCi5zWMW+5EU6gq91eNTiIgLFqN+AgvydWU1ziTHvPrtn3qjur9WyraiLgP0+lNwVzrQ 9s6YPppMuHaAgBhUiq5+CoVhBajNTFrOLPHn6okKVFThQKlgUJjMdoSaeyWqlO2/cDSb AjfQr+3XO3cFClFOBn/htFfY4aqtwR8drxIZjxbK/vcR0adB01FTDfXUzweCnpDmP5lE 95AAkwE4JtKGirXSp8MnDqNPNhSUq4RGcpV0SF5RKJPhXg4NrTUk9jtnYd/3o31AsfLp yvUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VRXDpEfk; 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 d15-20020a170903230f00b0017684491caasi20041306plh.594.2022.12.06.09.59.37; Tue, 06 Dec 2022 09:59:47 -0800 (PST) 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=VRXDpEfk; 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 S235255AbiLFRgI (ORCPT + 78 others); Tue, 6 Dec 2022 12:36:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235144AbiLFRgH (ORCPT ); Tue, 6 Dec 2022 12:36:07 -0500 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4207232BB4 for ; Tue, 6 Dec 2022 09:36:06 -0800 (PST) Received: by mail-pf1-x449.google.com with SMTP id cp23-20020a056a00349700b005775c52dbceso640921pfb.21 for ; Tue, 06 Dec 2022 09:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=qDEmCeemZEhSqKDixoru92cxFOmUueLA1+as4+4wo7A=; b=VRXDpEfkgrTrYlFOfzS1yXjcPrpeBHd7K7YTfAHbd7aITI38YIhDFDC7hyMnwMOsYn fUbWJIrPmUG66HmbBOsfOTBH5pBqEDE4kpaV/ZXQghfsPtkPR1vl5wm2CP9tHgFhQH3u uKyfbzxZZQrvALyHVvKyEzwmayOCUysiVCNdUOvcmsBnfIvxSwuG6C7WKCHb1V4/Fx3P 8aE8rNVl7bXOcVP4crWPgmDdgZxGNp7SkeGrQh/t+iOoOm+iyKxe1CLyadXFIea+yvyV L6W1kZC+BX7qeWowNj278A+ojljC1D1hRxQJsRS8BAtpfCg/z6y+EH7TKaeAMuUTBjSI JVBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qDEmCeemZEhSqKDixoru92cxFOmUueLA1+as4+4wo7A=; b=pcMRvsHzzn4pKmxwuuyv1qvkQqpXbxz0RXbBf/hNeILcE1UArydvHKPGhTXS34ODGg FzmbtJuwl2tneeUnRoEV3uZgwhUBz0lw245/m0Rv5+8Q8EEBOhq8M79nCBbjNLyGmjU8 VkBpznvoAZ900oOWKZaH1v1GP5T/bz8wDYnFOwpYpF+evtvuLwUEQ3Qk+aL3FXESXXMq ekwIbdRKX8F9O8fiEJCU4EqlKCEp+2vj32YOLC+zvm5XUnkp0ZkTUImQmdL+Uy8puI87 KbdPEREfEVkmzRYpoXfxTwhqFbkD0pp15F6s44N4KnR8PE32z5Tj33Kv/L1QB8CkE9iR mM2Q== X-Gm-Message-State: ANoB5pk8eNgTsBm3YMLJY+obO7sInqKCux11c3GumddRcrTRdOY6JFsc mizmwgJQ4m0PNDewVIFFoBb5bRSaqGx1wNDk9LlmySBRi7jFXSH46C82ObxldLlt56Iswfs30rv /PZDqibsihStJnM1U4NwN2vHdJ6Ca4wRJqOhsz8k3+ZxmVoUtUq2sFaUuZcSil768jTQmUh3u X-Received: from sweer.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:e45]) (user=bgardon job=sendgmr) by 2002:a17:902:8e85:b0:189:8ec5:93fb with SMTP id bg5-20020a1709028e8500b001898ec593fbmr41984489plb.154.1670348165621; Tue, 06 Dec 2022 09:36:05 -0800 (PST) Date: Tue, 6 Dec 2022 17:35:54 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221206173601.549281-1-bgardon@google.com> Subject: [PATCH 0/7] KVM: x86/MMU: Factor rmap operations out of mmu.c From: Ben Gardon To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Peter Xu , Sean Christopherson , David Matlack , Vipin Sharma , Ben Gardon Content-Type: text/plain; charset="UTF-8" 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_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 Move the basic operations for manipulating an rmap out of mmu.c, into their own files. This is the first step in a series of series to split the Shadow MMU out of mmu.c. Splitting the shadow MMU out results in about a 50% reduction in line count of mmu.c, from ~7K to ~3.5K. The rmap operations only represent about 10% of the Shadow MMU but are split out first becase the are relatively self-contained. This split may also help facilitate the addition of kUnit tests for rmap manipulation, especially the fiddly bit flag which diferentiates a direct pointer from a pte_list_desc. This effort is complimentary to David Matlack's proposal to refactor the TDP MMU into an arch-neutral implementation because it further clarifies the distinction between the Shadow MMU and TDP MMU within x86. This series contains no functional changes. It's just a direct movement of code from one file to another. Whether this rmap code should stay in its own file or get merged with the rest of the shadow MMU code as it is factored out is open for debate. Ben Gardon (7): KVM: x86/MMU: Move pte_list operations to rmap.c KVM: x86/MMU: Move rmap_iterator to rmap.h KVM: x86/MMU: Move gfn_to_rmap() to rmap.c KVM: x86/MMU: Move rmap_can_add() and rmap_remove() to rmap.c KVM: x86/MMU: Move the rmap walk iterator out of mmu.c KVM: x86/MMU: Move rmap zap operations to rmap.c KVM: x86/MMU: Move rmap_add() to rmap.c arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/debugfs.c | 1 + arch/x86/kvm/mmu/mmu.c | 438 +------------------------------- arch/x86/kvm/mmu/mmu_internal.h | 9 +- arch/x86/kvm/mmu/rmap.c | 368 +++++++++++++++++++++++++++ arch/x86/kvm/mmu/rmap.h | 106 ++++++++ 6 files changed, 492 insertions(+), 432 deletions(-) create mode 100644 arch/x86/kvm/mmu/rmap.c create mode 100644 arch/x86/kvm/mmu/rmap.h -- 2.39.0.rc0.267.gcb52ba06e7-goog