From patchwork Fri Jul 26 23:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13743465 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D660C3DA49 for ; Sat, 27 Jul 2024 00:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Cx2uwWro3wQxHPvpUbBfNMOIaJj2wri0zL/P/0Je2BI=; b=Ew16/cWpTufjmiKqr66gnC16Gr yzuDHyEx8Ulq4OySGrr+3iIGn5kcr1ezwb+8W5Vke1xay4hOXdNaL3CX6kzSb8OkFbcWoZq3EbtXU 65YsSjISxJhBC0cy+scIFjvT6I6a5UcoDzm7A0203wFeBNKrUDA6dSWibRWI8jJMeWIGF0Sv3V0I1 5+V7ogQl0YNu6oMD8p53qk/he22A1uIhmq6gNYA+DojZLqq+TmWYTOE4quEGFhXWRTpf9mVC2TUiK r9eOf2iOPkWSOA+DS6NTI5ugrDducuDecXfnTIJGSCZAUfGk1c6upX5JsrR0/xmquXhm2qZDYnRw6 zhWs0ZjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUti-00000005VN3-3PWm; Sat, 27 Jul 2024 00:02:54 +0000 Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXUka-00000005PmP-2eIF for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2024 23:53:30 +0000 Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1fd8677380dso10144305ad.2 for ; Fri, 26 Jul 2024 16:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722038007; x=1722642807; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Cx2uwWro3wQxHPvpUbBfNMOIaJj2wri0zL/P/0Je2BI=; b=tZZkRN6JgG5XvJu8tFToFjXh13MDbQ2r0pmOp57B4dOJhYdLXe3RQPpSHktuUbs0R+ mb8AgTz5P/cJVN1yGys15N9ACbNv2bAlnm7SudXKofX9TAm8iVPQzu9HIT8xlOAGiuER 562xbI8qZX4SPvt8eqma+xohKLoFtPhXIVohOK3SkGZ/DAque4D7+WVyYxqgUksYuA7V F8q+eule6udySzhN0tDcnsJAX2ItKW46+YoqHoJ4NMnlDML2ISNifpO5UojOrA/lkBCO mMrD94/rwgZsLQ9EH5l8UnWuTg5ATCfYulfd+/1sVe5MS1BCUUOQcNGjamRXf2uSSmZH zmzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722038007; x=1722642807; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Cx2uwWro3wQxHPvpUbBfNMOIaJj2wri0zL/P/0Je2BI=; b=JwYq8RYRFF33S4ibACAMAKoCDkT8TVVe0dXnm9BwNIDJuShWlncalrOcpSDx9XYHGh /LPqG6P8FcRkX8xlM1bF/6hJW3VJtWRGjwtA9TOYVj6WGVZOkhpghtWpuuN3BxjsPvG+ y40a9cULlY7/fiCClzDSrO4Pa0pK2yVH4PREWPPjQ2DlyZcGi91A3AbeqKwSyUpubG7q aEOGtsPFWWGimJvrBPqrzawilE3ylzDlpolOKcJ58dqDLMmCrChYEkfa1KgvBMhMmEtH SsK59o9uZVytcWGLvancLGPyvM9tTmpJIgEMDZZIAOfbueVKF/q9YfTVDsrpQtfR8a/6 Ukww== X-Forwarded-Encrypted: i=1; AJvYcCVSU9Bs/M70Kbs+IA77dN/hnUstOJVbi9Xohe25Pi1wDSwxC9wgfATYYvnum+AmNOJejmPYqNkxlMCzS+LSA9SqAWropX790rseVIE9A2GiLS0sGgE= X-Gm-Message-State: AOJu0YzqkwHUg4IpQlfgxBkXfp0KkByMnFAULcHDWF62vNx593mGa0PY Np38VInHY5QtHTcDcUsna4R6no1pHsFyYZ0mxsrUsADA0ypFh4Tafjjh2uG+p9OsfZ9c/ctJD0y EVA== X-Google-Smtp-Source: AGHT+IFyTmAdCKGjl4Efd/ur3Lgpr5WGUo8BVtVPeI74QsMUPNsZhPnU9qRmgrxg08u1lYU5BCnREsvFCzc= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:41ce:b0:1fa:acf0:72d6 with SMTP id d9443c01a7336-1ff0483372emr764645ad.3.1722038007284; Fri, 26 Jul 2024 16:53:27 -0700 (PDT) Date: Fri, 26 Jul 2024 16:51:33 -0700 In-Reply-To: <20240726235234.228822-1-seanjc@google.com> Mime-Version: 1.0 References: <20240726235234.228822-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.rc1.232.g9752f9e123-goog Message-ID: <20240726235234.228822-25-seanjc@google.com> Subject: [PATCH v12 24/84] KVM: Use plain "struct page" pointer instead of single-entry array From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Tianrui Zhao , Bibo Mao , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , David Stevens X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_165328_770262_BB3A72FB X-CRM114-Status: GOOD ( 13.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use a single pointer instead of a single-entry array for the struct page pointer in hva_to_pfn_fast(). Using an array makes the code unnecessarily annoying to read and update. No functional change intended. Signed-off-by: Sean Christopherson Reviewed-by: Alex Bennée --- virt/kvm/kvm_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 3d717a131906..8e83d3f043f1 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2763,7 +2763,7 @@ static inline int check_user_page_hwpoison(unsigned long addr) */ static bool hva_to_pfn_fast(struct kvm_follow_pfn *kfp, kvm_pfn_t *pfn) { - struct page *page[1]; + struct page *page; /* * Fast pin a writable pfn only if it is a write fault request @@ -2773,8 +2773,8 @@ static bool hva_to_pfn_fast(struct kvm_follow_pfn *kfp, kvm_pfn_t *pfn) if (!((kfp->flags & FOLL_WRITE) || kfp->map_writable)) return false; - if (get_user_page_fast_only(kfp->hva, FOLL_WRITE, page)) { - *pfn = page_to_pfn(page[0]); + if (get_user_page_fast_only(kfp->hva, FOLL_WRITE, &page)) { + *pfn = page_to_pfn(page); if (kfp->map_writable) *kfp->map_writable = true; return true;