From patchwork Mon Oct 14 10:58:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834701 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 8C647D1A443 for ; Mon, 14 Oct 2024 11:01:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D8016B0096; Mon, 14 Oct 2024 07:01:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 160926B00C0; Mon, 14 Oct 2024 07:01:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 000A36B00C2; Mon, 14 Oct 2024 07:01:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D318F6B00C0 for ; Mon, 14 Oct 2024 07:01:13 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3F083160D2F for ; Mon, 14 Oct 2024 11:01:05 +0000 (UTC) X-FDA: 82671915774.07.E16A06B Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf13.hostedemail.com (Postfix) with ESMTP id 76BE920013 for ; Mon, 14 Oct 2024 11:01:05 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf13.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728903567; a=rsa-sha256; cv=none; b=tkWGzMrCvnonNiDz7x6ifBVdhOUWyOwMh4+ha5VKEkK17upa3hxLAVejnOTgfTPQCFR7+A iHchl5+HTb8dFOZZRdWIEXhRuy7BUdSKZixlM9tK+/MjWzvv9kkhQLIhOnmRzp8TkD9+17 rUrwu4wB0IL/I1AF4fA9aFvcmTLXrrg= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf13.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728903567; 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=X8VEpkJ0okgdpGRrvWSbQdQmtub8XCGEswPb3bOfN9k=; b=nUnThHrsPpyU2HJ3BcaotXtaUgdND9i46uTaM75W2yWQE6DJgKSXgy0OptHGnEpPIeSI6/ Ghakq43QI8wUo1L7nc9V7x7rzjdSpCAw+DqTncdVvAPb+TVGznrocnJhcosr7RhjDjoP0F tT+chi397iulqdvxKYoJNyTAFSjrWcg= 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 B62B016F8; Mon, 14 Oct 2024 04:01:40 -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 78EA33F51B; Mon, 14 Oct 2024 04:01:08 -0700 (PDT) From: Ryan Roberts To: "Jason A. Donenfeld" , "Theodore Ts'o" , 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 , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 33/57] random: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:40 +0100 Message-ID: <20241014105912.3207374-33-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-Rspamd-Queue-Id: 76BE920013 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: y7z8k4r8z9g66c6wxyoeswjxbtn56eej X-HE-Tag: 1728903665-469755 X-HE-Meta: U2FsdGVkX18VSyS6MEQdUR6z9t0eG6MVnVZUjulmLpBE7pf7BlOajLgRa9H/midKrLjWxgmpnzCKTRnGG6C0xJQ8kw/UhOj012TiPTo6vhoShAZxeSEWbE49FFfOx2UZ+MuGfZI5BVLrLNxJh1p9wAKbTVGvtMkTwxVYAP1QMNkOlZnSG2I6pOy6q/RxpOxCUOa2SWK9t7mKGitjZAHoFd1+P317sWOWekCkno/sxweya4ReVTLpW2hjC5s0yBXrajXJtzZjLVSEO37FeyJk6ZOjiXmiu9p+iT6bzF2NI7gKzDuu7dW57j8OIkyI7GZTGhcsNYZHnfsNvN749h7fxlYjcszxS6p2tfzFpsPE5nRMdmJuoZWdglGyg5v2clVrnwuMVSmbP5Ql+xqkqoDX4k+377o9PTda57a80jZzP8zi+/sdmJy1BV60/PtWuZoEeh/7HlBgP/Thv8waXLRrpDu5yS2ZTi7qnikU/fi02xFiHG8jg2SEooaAn/EonoyRb+Iy8BcfmvDDQYp/s4CQyZ9aiZ1mjiuHlOvcCWev1pe4STDeVwuRfsP5f8jcbZgsgOLdOImCqfPL3RGdDKhcjrS8tsgsWf05RQeZltR6oDTL1JQdA4U263NQJAizE/LqDjCNSe6YLUfasZtrijKbKIsDtnw9BO/vS3MpfUkJcaJFa6wNiy9Uq18UVJxHb8+g1oemiEoJve7m2FxHy7+sP+zFmDgGTG25PNVW58mTnN336DAkL2cTzi0B8X7RpCYMfhfh/jPQUQCgryfTZjJNzexdiIbb0ZmfHqu/4fG/PRKh7h5PPibVbnJJm/RPa3RbyU8ZU5yuYhehDD5bRxUhnT+cPsWvOh9OoMK7m21ZkoqcAn8HnEG42XVoQxpun+57We/dw8DmMWTxpxr83W3FjabSyEECORPeTLh9OFUAKRxMiIMOK+Rt1rqaIFW3+ix8ulMhgbkTdp881P1M14c Fo6N8wQl htwXyOZqwBy1JptRVha8KSbY2P69AwAvbvFRRnBmmBG4ftRHqnJexzZtTO6lslAizOnsHF47vcLeqjMHFbGplxiL8ME2ssKlMNolhcqAOCEUBAghO7whRyr/t0ybIE7BlYoe6Lohl094tcu7dPNRNkirv3uJ87c/fl2YuVe9r6Oyr7SdkuWroeoZAyeKxWvMYrWMkZtNAWiV2idDyEgRTIm59q6DfPEiQGpxQ 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. Update BUILD_BUG_ON()s to test against page size limits. Signed-off-by: Ryan Roberts --- ***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/ drivers/char/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index 87fe61295ea1f..49d6c4ef16df4 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -466,7 +466,7 @@ static ssize_t get_random_bytes_user(struct iov_iter *iter) if (!iov_iter_count(iter) || copied != sizeof(block)) break; - BUILD_BUG_ON(PAGE_SIZE % sizeof(block) != 0); + BUILD_BUG_ON(PAGE_SIZE_MIN % sizeof(block) != 0); if (ret % PAGE_SIZE == 0) { if (signal_pending(current)) break; @@ -1428,7 +1428,7 @@ static ssize_t write_pool_user(struct iov_iter *iter) if (!iov_iter_count(iter) || copied != sizeof(block)) break; - BUILD_BUG_ON(PAGE_SIZE % sizeof(block) != 0); + BUILD_BUG_ON(PAGE_SIZE_MIN % sizeof(block) != 0); if (ret % PAGE_SIZE == 0) { if (signal_pending(current)) break;