From mboxrd@z Thu Jan 1 00:00:00 1970 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 1887DD3C544 for ; Fri, 18 Oct 2024 03:00:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8F1DA6B0085; Thu, 17 Oct 2024 23:00:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87DCF6B008C; Thu, 17 Oct 2024 23:00:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BAAF6B0085; Thu, 17 Oct 2024 23:00:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 109466B0085 for ; Thu, 17 Oct 2024 23:00:43 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A06AE804C7 for ; Fri, 18 Oct 2024 03:00:32 +0000 (UTC) X-FDA: 82685219778.09.EE9D44C Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf09.hostedemail.com (Postfix) with ESMTP id 270AD14000E for ; Fri, 18 Oct 2024 03:00:32 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ycs27AlH; spf=pass (imf09.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729220366; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=B+PqcdpWNS4u7ZHFgo8/hLkbYu5t2LAmdihHzmnrPdo=; b=GJFiUr2nOuS+TjtIARQThnX/g+MjxI2lnLbpFORHrRwmsVm9fOaDDj/sAj15xXr+2D8Dq9 r9hejHLCS6Tnc5po818xSBO6AuYhWwzLJR40iDOssVl6vJNhRZa6gjpK287fBy+kZReZAC xq3xhSbCul20FR5VLPtszmHXWijCUPM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Ycs27AlH; spf=pass (imf09.hostedemail.com: domain of bhe@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729220366; a=rsa-sha256; cv=none; b=CItcCn/GAIukZ55U2F4qK8Dd58NNgdnrkcwOR0wQZ1FXCORF5o6KFjenWV4dPQmQC3cgIU A6f+FqjvT4ctFHiKgph7Heflk4d5kulgkulZcvKqoqQFp2E11gxIxL3d3CTiQBJm2/cPpv hap1cbH9czpqHB7+TXxqRMziffOwRBs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729220440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=B+PqcdpWNS4u7ZHFgo8/hLkbYu5t2LAmdihHzmnrPdo=; b=Ycs27AlHHtHvM8ZfaiMiczYrGKD5hMS0/PN5Od2G42D4fbCU/etx175ysntQDhvGBdRKtQ WnroIgfN/ZoRyU2FQAvnX0N08fsXnheuC0cp1e+guIalEl16/FlEPxSk27meLAW2jK4Xqo lzV+nH67QWUA2LpKIY/tJqCypB0t0kk= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-15MAYLMPP6OTtrhbesPwiw-1; Thu, 17 Oct 2024 23:00:36 -0400 X-MC-Unique: 15MAYLMPP6OTtrhbesPwiw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B5F2C195608B; Fri, 18 Oct 2024 03:00:32 +0000 (UTC) Received: from localhost (unknown [10.72.112.28]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 08F5A19560A3; Fri, 18 Oct 2024 03:00:29 +0000 (UTC) Date: Fri, 18 Oct 2024 11:00:23 +0800 From: Baoquan He To: Ryan Roberts Cc: 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 , kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v1 19/57] crash: Remove PAGE_SIZE compile-time constant assumption Message-ID: References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> <20241014105912.3207374-19-ryan.roberts@arm.com> <2e561511-ab20-4aa9-9b92-bd6ac6678087@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e561511-ab20-4aa9-9b92-bd6ac6678087@arm.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 270AD14000E X-Stat-Signature: onxqcq6ctrghjbdpbnzw5zjxk1gw1yz3 X-HE-Tag: 1729220432-490310 X-HE-Meta: U2FsdGVkX1/o3szrXy+I5KzA10Ti6bcich6XU/X7oIbs8+vR4F6VPZ4N+jPuPbo9+sm8oJ+Zpj0rZe70xVATLSH3MvXj+KUj3gj5VbjipiBuUELXvONGcM1H5o9sByoUJBdQxgwXQFYreW2/2pp6vIRD/nvQbALm2WFXHIknWWBAl8xxLC6faf3JBOtSZg8NXAxA8o4cLdhHVjKQI4mMMGGOR7ibCshDobaXJP1/4bFTXEDFipm+4tSZ5InntClb3oX+bl7gkdM/NxfQSZD53oC2zqA71KuPMTiemPrRiidW6zgNXZsfTdiHZqpSxspTeHqiVY5mdyQom//r5m09srG57RSB9aUhCpFq204G1+Zx8i4MzQIo95nGG9iPfgudPSWInVy4iiFB43a9LxZBDu6IDNSrX1AKUJZUdXbK+ms5+o6fa2qKlDPCXJsfaemmMVr6kTz7z+lfLOHEMun2iD2l713pcb4RS6qXmbu+kFK2Ch+L/+by6vEXuF0df7PoGifSTXEssqymam5354cAvJlQDyzCjmEo+cuIso5KxahQFWdyA7NkQGVKUeTX+F8ECXAKXdibMrtIBbez46pmvh0SuxbZ1c7HuXtURvvAiqM30c2h8NuoP0F69tHkHfGUTQIf6kSl3hnvNPTvCPVR8FE6zSeynkZK74HKPJx9nnb+4As9EAoaR+bAo4z6yN2H5R1EU3osrwdEEFyWLzPEQGhtsPHb1QMm3ny+8NYek/SeiF5Otzlo/+kZn05XmeDGf9ddqlVYQo41/pLfUbMEuUJpDG9ZusN3M+IHMqzoaEPySXbqdyOJh6x5bl4fgn/cBMAkIod0rIT0lmvaITySBcfvv9niuf0eBLH42jzKpCpX5MuV6/w/stF0U51MU+FV0ZWWRS5S0RcGm374gpl6wypYcUdfA2RGsVoYhbzVZIjHA+6EpossBlQfunVpww494s6RbRkPkuFCJmcMc6w ttL56aCn tKzO5pdoJq1ahEsuzGFNWuW+u+hvQVUN2VcUrY1Q0Vg/NcSFbPCczAobCWRgYqRn784XSokDQol8IYrVC5oqc3Ec9ZlJZqQiKa0seNkpeShXqmluEeFDfJHTmPM4bGKHz0vHxsHeQqiaKW5gALaHZ0UxDRQsFKuH9Z8sJSvN68Jxe7FWBMoQ1ih0LCIg8JmW7OMBnqRNVgRKSVerNCbo9sOfwg9/pxmyzrcq+kI/LRC7x0cSHqxuhwub0VU4V1c+QdEFM/E5TOIFk8QjME/dqGhv0sHjqTq3ze+JAFYKg/g0CNPn9zewImnmGE+4k4SJdL498DMOfIQpcXNiNtlhKcDt/QAiV+NNDhYIQMn5fZhsbUnCY4A4iufSH3rIkFGmy5OXQp4K7UX8E4i9d8m4EeKAknhKzTW9/NRPAwGfQddGNGEYc5crpf8EA93cIq4w358mvLvSNJMwFgRG8utbgPHZsWBROw9m6FQJtcmQX3iGjSnBUvUV+B7TsJwmRIhUIP9GQ 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: On 10/15/24 at 12:13pm, Ryan Roberts wrote: > On 15/10/2024 04:47, Baoquan He wrote: > > On 10/14/24 at 11:58am, Ryan Roberts wrote: > >> 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. > >> > >> Updated BUILD_BUG_ON() to test against limit. > >> > >> 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/ > >> > >> kernel/crash_core.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/kernel/crash_core.c b/kernel/crash_core.c > >> index 63cf89393c6eb..978c600a47ac8 100644 > >> --- a/kernel/crash_core.c > >> +++ b/kernel/crash_core.c > >> @@ -465,7 +465,7 @@ static int __init crash_notes_memory_init(void) > >> * Break compile if size is bigger than PAGE_SIZE since crash_notes > >> * definitely will be in 2 pages with that. > >> */ > >> - BUILD_BUG_ON(size > PAGE_SIZE); > >> + BUILD_BUG_ON(size > PAGE_SIZE_MIN); > > > > This should be OK. While one thing which could happen is if selected size > > is 64K, PAGE_SIZE_MIN is 4K, it will issue a false-positive warning when > > compiling while actual it's not a problem during running. > > PAGE_SIZE can only ever be bigger than PAGE_SIZE_MIN if compiling a "boot-time > page size" build. And in this case, you need to know that size is small enough > to work with any of the boot-time selectable page sizes. Since size > (=sizeof(note_buf_t)) is invariant to PAGE_SIZE, we can do this by checking > against PAGE_SIZE_MIN. > > So I don't think this could ever lead to a false-positive. Makes sense, thanks for your explanation. > > > Not sure if > > that could happen on arm64. Anyway, we can check the crash_notes to get > > why it's so big when it really happens. So, > > > > Acked-by: Baoquan He > > Thanks! > > > > >> > >> crash_notes = __alloc_percpu(size, align); > >> if (!crash_notes) { > >> -- > >> 2.43.0 > >> > >> > > >