From patchwork Thu Oct 10 18:23:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13831137 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 91024D24453 for ; Thu, 10 Oct 2024 21:01:38 +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-Transfer-Encoding:Content-Type:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/W6JK9yAcorM7mqEFQq2hRBqvFCoz2C4pz3yOEmiGek=; b=H37gJSh/efGVH2 cgbqjykThNlr00hjekmwc5DN9iHVLLOi3InOd+2uQMtX17O0IcOXKulh5frldt8G2hE5PFPUNlrym S0WRUSfngYu5ik0A1IVQaAVYm6Vp484KJX/lu9ww1nip5YNPJEqf/reNWvpsuAfZGkTt46O6MOA+Y Fpy6L/t3fBO81spdQFdUxEj4mHlw1/RsZYvxKtzxE4Lr4OG8hFU/VPiM6rAgGv5JG2yTXg8zuB6Bd 25IahaoyF4jHp1++i+ElAsEI8u11g6hqL3HTYXlqj+vGWX++sQmhX1sN0CmWq+fzZqG5MM6hfYv0+ oVt6pzFIYrfBpg7dKnRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sz0Ho-0000000ELlU-2Whq; Thu, 10 Oct 2024 21:01:28 +0000 Received: from mail-pj1-x1049.google.com ([2607:f8b0:4864:20::1049]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syxrA-0000000DqK2-20Ru for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 18:25:50 +0000 Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-2e2a013a01bso1334463a91.0 for ; Thu, 10 Oct 2024 11:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728584747; x=1729189547; darn=lists.infradead.org; h=content-transfer-encoding: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=/W6JK9yAcorM7mqEFQq2hRBqvFCoz2C4pz3yOEmiGek=; b=3ljqXwYT9KU7vL/bvKPf9S0Yn/qBntGvThCT2wzCd8Z12f/66N5sIoVWA14cY3wEXx g0HCLPAfoQ28OuiX6nzyAfawBv92qW+HPQQu37BsUa/V7uUuXJiLYMSM601iEwSqsUOf /NM7uP351CB79XT86j42gqhFKlgX/vbHgHz5DTqinJBvK+PcdaEbIaL+QrMPgT0FIbtp HGVX7X1ioRXdTGYtEGA8WTxtd6LOh1q2++W09WQfgTr1feSdFE+UnwE/XERuI/cMc2G4 mKN8Qf+/P7jUbv/vuDxwiZEcUlFeFFt/L98/apl6pTYPYAUmkiq5SNEFXz3+LRw5g5bM ZyYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728584747; x=1729189547; h=content-transfer-encoding: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=/W6JK9yAcorM7mqEFQq2hRBqvFCoz2C4pz3yOEmiGek=; b=MvBbEBeevq2cePxfb6YChK1xsn14X4CTHkUVdH6toZqnw9BkEkjF7CS7uWCa5Ae+f2 m45bdmZatcRMkp+yLspd4ckdEhK4PltoJGGdZmsBVtdd+iXq9sInFER+UVk6w2V6p2tN a7jvhPmqnr1NFZdi27608RF4l7BBf7zodFkXTClXALnfuW653O4u/D7s/cAGiySnrX9W 0Et42sc24/Iyk7aXOPvR9yoD7cyqWXthZgwByyjiocsGx2u31HUnJMB877xp8LhzB4u8 3gB1RE3VsQyAaoCSNxm9Sy545t8vrj8gdTK1FciVPSiZpYEO9IlLnkDwvfqjRaXJhy93 JAqA== X-Forwarded-Encrypted: i=1; AJvYcCVd97oidruXBWQmw7DZteHU1bnNjalYY29fToKGAdJZ/QBUuRDkyhjUBWKPaMQyGOFKZJ/N9qM8PIxcWMA/bkLC@lists.infradead.org X-Gm-Message-State: AOJu0YwOaPoAnRlH7zVnc7xC/ftbVCNj8a5pPTffl3XOfROCcy4JsRn8 gAuY50ysvFTykoweXQqvFXaUubssuHk+NJXKe9KxsNJMn+UU0WZyMBlIphNavHMrYW5hhkzqS/1 vUA== X-Google-Smtp-Source: AGHT+IFGWHaFUEsQRxn4rcRWabj8vzxqpLHdNOXqOmiiQlX4dD6MZqF5BpShV2hVfQIOX/PTyNMVtEMSya8= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:a17:90a:9a94:b0:2e2:da81:40c1 with SMTP id 98e67ed59e1d1-2e2f09f2280mr109a91.1.1728584746508; Thu, 10 Oct 2024 11:25:46 -0700 (PDT) Date: Thu, 10 Oct 2024 11:23:28 -0700 In-Reply-To: <20241010182427.1434605-1-seanjc@google.com> Mime-Version: 1.0 References: <20241010182427.1434605-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241010182427.1434605-27-seanjc@google.com> Subject: [PATCH v13 26/85] 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, " =?utf-8?q?Alex_Benn=C3=A9e?= " , Yan Zhao , David Matlack , David Stevens , Andrew Jones X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_112548_761263_0153AC46 X-CRM114-Status: GOOD ( 12.32 ) 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. Reviewed-by: Alex Bennée Tested-by: Alex Bennée Signed-off-by: Sean Christopherson --- 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 7acb1a8af2e4..d3e48fcc4fb0 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2752,7 +2752,7 @@ unsigned long kvm_vcpu_gfn_to_hva_prot(struct kvm_vcpu *vcpu, gfn_t gfn, bool *w */ 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 @@ -2762,8 +2762,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;