From patchwork Mon Oct 14 10:58:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834685 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03171D1A45A for ; Mon, 14 Oct 2024 11:00:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D9F06B00A0; Mon, 14 Oct 2024 07:00:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88AE26B00A1; Mon, 14 Oct 2024 07:00:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 703806B00A2; Mon, 14 Oct 2024 07:00:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5465D6B00A0 for ; Mon, 14 Oct 2024 07:00:22 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D0A84C0D24 for ; Mon, 14 Oct 2024 11:00:13 +0000 (UTC) X-FDA: 82671913674.25.7135291 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP id 73B47100019 for ; Mon, 14 Oct 2024 11:00:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728903478; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SCVxAiH0ahzES1Ifh6ZjiVheU6y/DFb6NZERTs5N+W4=; b=5ukpNnwrVMiVVhw+Jd+MvQJkd6Zugjf7CcLx9cUGfggSfRBE4hHpbIdy+0b8jniyocq1aU XyfdKiGh/15YsBJWfJwhTM2/hxzqnP1OAqXDqYxMtk+gGQIuN0cbuviH3r+Gr8fJyTUKkh nTjeWKcYeBFhloL0Io5vOuJdOHoosDQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728903478; a=rsa-sha256; cv=none; b=UqnOrdj4AMJDE4k5QqIP8+lPvvM8Jf/HRPuzK+L9q+ekkOFXXh5Jfa8LEiHu1LeO+lIHVb JqPSotHg/M0Oy34ikYmeMIk/yH5Va0Pv9A8CvyaNgVop8JtcPdC0/MNn3nzZSDzqKDxCDf ozQtwcBfU8T27mHVVXoj011dcdXzDrQ= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58C151684; Mon, 14 Oct 2024 04:00:49 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3A6AC3F51B; Mon, 14 Oct 2024 04:00:17 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon Cc: Ryan Roberts , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 17/57] kvm: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:24 +0100 Message-ID: <20241014105912.3207374-17-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 73B47100019 X-Stat-Signature: rzqs9mickg6kbsqce447g9mqd4ynbwdb X-HE-Tag: 1728903613-878934 X-HE-Meta: U2FsdGVkX18olFc3+WbeRLptbMjXekxiVL9E1Ayv3QCc/gpY+aVxQb5EFPgYXXAp6GGWL7FAKRPaeXk9L4/WLoaIkQRAjjnXq4sQn6YBRQF2jtjbGYEMbr9CYqC6t9K4/tIaJZvmBxv5uS5BgUHK0s+Fox5PKFFZKOe+WE+391nc4Z6X807SkNgFaIUwDyyahTEVE/U2IIHrkyVXPSx7FbuaT5nOCjVKvkRpru4XTZ+yOxqUMB1q+MBETLvs5RUpHpDgHksvQfjZxePA+GzQWIQ3eHFlNqFavqVUv9euI8Uy9YMOs/I6mt+mNjbX5gEfg+p2FYl0u35+5dKB4xfpDGD8rgUQtDOQpPaT/SFPaSOOjm9Qq7GnplCzAq5+7a28u4ne+zZ1IHyoEFQpL8Q4AUpZakw+AuPGoYlRMw/ei5znDrlxEldm9JgtRU0l/0VKPIWWjdkrdFA9depL42mLLKXn+uK6o/qAXj6T2VdV8e4RRCZXPrAoEX1g07DCn/R390GdD7ZIXksM2qYnjrvFKx1INRUR9YZuLmSSMRmz+tlhTQBZVnK3x6ri6kHJF1osze+H8TTnksBqAD7XXgSO0gQJD3gc/O3PEEaBnCa2kidG81Cgt9QLUMXhZedNOEavxeXR1vYqo/VUfFCC49s0n7X3bh5iUtDNfRX/s+MD40VJ4Gxt/l2tR8E8gLNEiONIKkvtEK4nj0UW4Rt0ZfXxVJqlAPaSnVX79NGVD3muMe7xgtZv8jplbgWnWqNT5mD1pr91T2eYxxLyuBhJr3GZImWC2ebCMHKU28WFziHA1a9IUQnR0SOSErT29CGos3e2/37pSkimqJ2dR7/U2RMNdv1IYQn0PDF32MsMje8mLkLj4xjeUrDZ2LVc/6ve7hNomVNME7y9j+voMeh4rRX6EEe4eqggNXAXJfIfFqnCeRS0P0c8IVBBydl5QvhXkSloBINyBgSDYywegrW8/pt JzNWlPOF z2yqA5F2bsPobW7fGywklNaqpc5fGRkPdMfES40btUZxNnkJTA8qDpth2MxUWOQMMXFEXDpWV+qVThKzJ71NHisvQf4g7nmGIUN10o65RGFFtffTUcjiPUticyu7hY5PQ0moD7DMMKpcaA0+r2LGnkl78qNIAim4MyjRsnCThYcW+k4lYFU06sqcaAFD3DcsKnFKw6uI+uyNplZ9lFovurfXTuziGAxWXYt8q X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: To prepare for supporting boot-time page size selection, refactor code to remove assumptions about PAGE_SIZE being compile-time constant. Code intended to be equivalent when compile-time page size is active. Modify BUILD_BUG_ON() to compare with page size limit. Signed-off-by: Ryan Roberts Reviewed-by: Sean Christopherson --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ virt/kvm/kvm_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index cb2b78e92910f..6c862bc41a672 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4244,7 +4244,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, unsigned long id) goto vcpu_decrement; } - BUILD_BUG_ON(sizeof(struct kvm_run) > PAGE_SIZE); + BUILD_BUG_ON(sizeof(struct kvm_run) > PAGE_SIZE_MIN); page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO); if (!page) { r = -ENOMEM;