Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4255978iog; Tue, 21 Jun 2022 15:45:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1veWVWiLK8tTR6XzxPmKUmXKGPVKoPlbjgm4nf7aF65nC6Uiq7a24C2789keXLMzJ32RUyY X-Received: by 2002:a17:90b:4c4a:b0:1e3:3b3:8800 with SMTP id np10-20020a17090b4c4a00b001e303b38800mr278516pjb.6.1655851522175; Tue, 21 Jun 2022 15:45:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655851522; cv=pass; d=google.com; s=arc-20160816; b=mXzmNbfotoi3hdkXbzuIHzfKyVP1txA8+Z5+6Ui0QLr8uBIvQUy0NSRPJqjeeLyDQq p9dXmM7qUpn4U0qUhlciv1Nnod4ly8376lo/L1BUa32bpdgWL2MmcGK4RCzUsNF7Yyug QdE1/8dqrIbURxNHpRazjZSndnAl1p3mxVqkGApofVo1Ws7iTQcQGy3Ux0v6IuYDTOOW oy1D6uQ2KIaTZRfBJVJro1cNg2GntL/9yiZVU8u+4TNZtEslSgplvHxQwxpH4z0vHtzF WjHuq9Q4XplXqhCOAVURdo5vggNsS5gF/q8l0kEG//zr0pSwXOIaO6Syh4xF4JaXu2hK oYxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=akU42WsKLz86iUDjTMh0NGRE1HkzdIezsAda82vShjY=; b=ylWNW4qfpyd9a/7pyLi43D38Cbm8eXnfTwfil2iOGmqjkY+Cfo285SLnpGEG827fD5 ckVah3LSLyE/zhjlQr58vAvFVoQP1VEeYMJiemucmsVhjumKIQfaKJXIEqaUCSntgwxI k0v9VVRSDMv39lalCVEZBKnAiLb4/inZvNkY20kJy5XknOvJPNKDu6cWgrPc/XCmGIgH fIvhOKp8+uUvnHZWkTLim8iEQytYARSF8YJxPpXes7XiFSPX5h7Q8ujriJ6AC5amVX4q iYL+MqaTU2Sdzd3I15NzFQthLYOFGhlz9xk+/UzxB8Ha25A+w6G7wRthphj4PrdB2VNo PsAg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qj6vjx30; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d132-20020a63688a000000b003fbd7285a83si20536761pgc.817.2022.06.21.15.45.09; Tue, 21 Jun 2022 15:45:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qj6vjx30; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354433AbiFUWdp (ORCPT + 99 others); Tue, 21 Jun 2022 18:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiFUWdl (ORCPT ); Tue, 21 Jun 2022 18:33:41 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2042.outbound.protection.outlook.com [40.107.237.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC289FFA for ; Tue, 21 Jun 2022 15:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RV+9YRnF3u+IbhI7BCN5WVTMHh9k04a7lglDee0owZ69oDr0/4Mkkr4a3WfV+ntQBrmqqqWq2dh3cK02CsC0ubBmhQNweLgEuAqJsGPVz81o8b1ya4ZgFGUj7OZNON5R4jJIak9QINuev2v0rbKsz+/C5c2DtzoOMiDAtUjMO6vOklYTnlOEGhhymzLf3EDDKF7blh/RF4D5mGyWEcw37Z3Ai7Ddl4ns668zTu9DQbf8PINEMC7oWAh170NzhHbop5OlF798i4bjrHxeLrPLi35MuNDkOON277w5ri/EfFK5KokznLfa46jpLttIzwEF6raJGevq5fEcSb/Jll2cIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=akU42WsKLz86iUDjTMh0NGRE1HkzdIezsAda82vShjY=; b=O4qmcxfdQQFfJ2LRo1FEdeJX6oX4ada2/PVu2lCYcJYiIIJKUh05SkRlEuFEHZq7dcFjrOXdT+2hholxEqJabBc0wsTnyHozRw0e3V4S0TCjacxySg1ChHOSnzPyR3dvDkenx5NiUZtW0FgLdcEhrro+PYahS/j4FKDcWmWKuPk3Yld039HKA0APWQwO8Mg2Ypw7MQ/iroeco+oWeiwc5PV/mdMIEHVIRvnPUMueRyIQBEMeB739HhJl0lnQcW/0r94idfzf0PNs0CvXRR3rDSmi7w8ihLFQZFU93hgtFGFTCy/aEH5TJT0ActtxOyT1xaJzCb5i44pdrdqwAv9wrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=akU42WsKLz86iUDjTMh0NGRE1HkzdIezsAda82vShjY=; b=qj6vjx30bhONtT3qZGO92bLG7IkVf7NgW1PVXx1UdgOZ8uN33rmV+TPSQzf0Gx4Rqr3BGgBR9MXI5ndirnKm22PyfjXRv/fnr9QIBJhzHDt7cQ5TyMC5RvYYdG61gTvcI4p7IFg5O0ItNZzZ/Gku5Sxl15GfiElUIIfM9xn0yopn0TkDSJ06wPv2hdjHrrcr2KgOE/JfSG87F8p1s+k//SWuaR22tbLs3WHk2fIzJpqtY6JiiaWcs5WSu209Nr7AicdgmSceTQ/OxFjqxV58CspshnVmGhSCHVZ1eS6Z1lb/l+2TnKuoqRKWYibPqCubP4kAWD15s+SXEpkbAlRh2Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) by MN2PR12MB2879.namprd12.prod.outlook.com (2603:10b6:208:a9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.18; Tue, 21 Jun 2022 22:33:37 +0000 Received: from DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::c44c:ea8d:1b00:5fdd]) by DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::c44c:ea8d:1b00:5fdd%6]) with mapi id 15.20.5353.017; Tue, 21 Jun 2022 22:33:36 +0000 From: Zi Yan To: Xianting Tian Cc: David Hildenbrand , akpm@linux-foundation.org, guoren@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: fixup validation of buddy pfn Date: Tue, 21 Jun 2022 18:33:35 -0400 X-Mailer: MailMate (1.14r5898) Message-ID: In-Reply-To: <502ccdeb-372c-1d05-4b5e-a962f39cfb55@linux.alibaba.com> References: <20220621031118.3650529-1-xianting.tian@linux.alibaba.com> <502ccdeb-372c-1d05-4b5e-a962f39cfb55@linux.alibaba.com> Content-Type: multipart/signed; boundary="=_MailMate_6C734AB4-0073-4883-BBF7-9D9EA7B17258_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-ClientProxiedBy: BL1PR13CA0411.namprd13.prod.outlook.com (2603:10b6:208:2c2::26) To DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f61f440-ed66-44da-78e1-08da53d614e8 X-MS-TrafficTypeDiagnostic: MN2PR12MB2879:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CN/aGEEY5b4cx5wrTouYIle+5kva4xTG3y5vkW8PxHtOwkWS1RS6TQ8QWQYwIucOlvFtPJG9uNs0QqSZl8E1Oi5qNrDLCBulgxUygiV3YueVL2tcbCitoYUUMPRWlJuB9xPrhXmE79Z+bIQVHOuqHx6cCepqRigGzWFo9LkhhNQuvVnqP7uSXVT1MftUj1UExd1KBwBrMtsm2BvxwUEZlhbeCmwo4YbHZ31qukYhYKcFAh5BpLUrJi/YPk4EgPF61lVaWfSlpgZZflSgKsMWzI7qXqmkfM0jj3zYqoOuU70qg2hUGWOqLmlUgqv6pA4wMDnIL4qCganQnQRJ/3FNqIObvDxCrYFyrLhTLjgeypbDBGHrP4CqHqpp79kP5PNX3+E1+u0VzT1Php3u1jXmYOhym2X5jtVFibJzjhiBGZOiEal3WZK+GrVlUVcD3OPNmKxOW+CN7M4xIuDfPk8O5NM9seLRH0VIzVWvw7o4fairHTRj23GqP1HFSgIhP9p20mTqUeg+TWJfK2DwuR8fgQFdQMgux+uq/aH1XJK2s7gYJvSHO3GLtsLQ+9629/Urs+hyBjrPcxfKzrsyWKI8qVyjILtaAnMJsxxJFtZ+zpC7aLmgcm5b3ibEoY9Ye8ZUXjxcBMgg9FExkAnR5TxY17s4ds5lAJATV+YhWiFIY/qAebIZLUACqJa6HP4F3IzuYwO+TET0A2GpwYGsICn05iGcUlbdqqjPLohxZm08eXk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB5744.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(136003)(366004)(376002)(39860400002)(346002)(396003)(33964004)(86362001)(6916009)(6486002)(53546011)(4326008)(8676002)(6506007)(6512007)(66476007)(26005)(66946007)(2906002)(21480400003)(8936002)(2616005)(186003)(235185007)(316002)(5660300002)(38100700002)(33656002)(83380400001)(41300700001)(66556008)(36756003)(478600001)(45980500001)(72826004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N0pFcFpvZmhwYVAwdXlPTGxieHJOaU9ic20ycHo2MEl4aEd4YitTWkdjdTVr?= =?utf-8?B?N001WTFnak9JTElIcE0xZ0ZBSlFmcm8wQTh3OFpZMGFWWmdpMVh2MUtqYUZa?= =?utf-8?B?eEpEeTIwdHgxVXh3bXhWSXVwd2VaWWRTN3Q0RTNUYUs4LzZnaUJucGh6Uld5?= =?utf-8?B?SE4xSUJ4SGs5ZXQrY09Ya0dKbXJlcm55UE8yT0diMUlmMFlXZ1NWcGt3OUFP?= =?utf-8?B?bURzVDVIK0d5bEkrTmJNa1VXT2NpM1kvM1Z4ZXZkQ2MwTkVqRWl5VHFGRSsz?= =?utf-8?B?Q2p0bXBWZDBYU3dqRmJTbGxwcTI3L0tBQWdnZlVtN3ZHL09yeTlBbVJWUWlX?= =?utf-8?B?LzZDU0RERFo4UXJzOXNi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VJRbDNqbUh2clZh?= =?utf-8?B?RUZtRGVNcjIrWGF1anNlTURHa1dUY280QnhqNHFJL0FDRXhJajBMcFVmcGtk?= =?utf-8?B?RVg3ajhteVNzWmp4TWRObkp2aDVicEtxM3d1elk1ZWNDTytNTlBiVXMxY1hw?= =?utf-8?B?d2k4dmhYQ1pDeHg0QWRMUGZrSHVWZ1BqNHRnOEFBSTVxRG9tUWUvZz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f61f440-ed66-44da-78e1-08da53d614e8 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB5744.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 22:33:36.6326 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iGrgPLdj0+/QNsN5t+7kV+B16kxKPsSGZUwnWdrV3DhJ0MRPWDm0uF/sIN1ZBwC+ X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2879 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=_MailMate_6C734AB4-0073-4883-BBF7-9D9EA7B17258_= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 21 Jun 2022, at 4:49, Xianting Tian wrote: > =E5=9C=A8 2022/6/21 =E4=B8=8B=E5=8D=884:01, David Hildenbrand =E5=86=99= =E9=81=93: >> On 21.06.22 05:11, Xianting Tian wrote: >>> For RISC-V arch the first 2MB RAM could be reserved for opensbi, >>> and the arch code may don't create pages for the first 2MB RAM, >>> so it would have pfn_base=3D512 and mem_map began with 512th PFN when= >>> CONFIG_FLATMEM=3Dy. >>> >>> But __find_buddy_pfn algorithm thinks the start PFN 0, it could get >>> 0 PFN or less than the pfn_base value, so page_is_buddy() can't >>> verify the page whose PFN is 0 ~ 511, actually we don't have valid >>> pages for PFN 0 ~ 511. >>> >>> Actually, buddy system should not assume Arch cretaed pages for >>> reserved memory, Arch may don't know the implied limitation. >> Ehm, sorry, no. Archs have to stick to the rules of the buddy, not the= >> other way around. Why should we add additional overhead to the buddy >> just because arch XYZ wants to be special? > > We ever sent a patch to create mapping for the first 2MB RAM for RISC-V= , But it is not accetped. > > But I am just wondering, if we have the RAM whose physical base address= is not 0, for example, start with 0x200000(2Mb). > > Then the base PFN is (0x200000 >> 12) =3D 512, Do we still need to crea= te mapping for the non-existing first 2Mb RAM, > > if not, the issue still exist under the case? > How does RISC-V get mem_map for 2MB-4MB in FLATMEM? alloc_node_mem_map() = from mm/page_alloc.c only allocate MAX_ORDER_NR_PAGES aligned struct page. >> >> If at all, we should fail hard if an arch doesn't play with the rules >> and make this a VM_BUG_ON(). >> >>> With this patch, we can gurantee a valid buddy no matter what we >>> have pages for reserved memory or not. >>> >>> Fixes: 8170ac4700d26f65 ("mm: wrap __find_buddy_pfn() with a necessar= y buddy page validation") >>> Signed-off-by: Xianting Tian >>> --- >>> mm/internal.h | 6 +++++- >>> 1 file changed, 5 insertions(+), 1 deletion(-) >>> >>> diff --git a/mm/internal.h b/mm/internal.h >>> index c0f8fbe0445b..0ec446caeb2e 100644 >>> --- a/mm/internal.h >>> +++ b/mm/internal.h >>> @@ -322,7 +322,8 @@ __find_buddy_pfn(unsigned long page_pfn, unsigned= int order) >>> * The found buddy can be a non PageBuddy, out of @page's zone, or = its order is >>> * not the same as @page. The validation is necessary before use it= =2E >>> * >>> - * Return: the found buddy page or NULL if not found. >>> + * Return: the found buddy page or NULL if not found or NULL if budd= y pfn is >>> + * not valid. >>> */ >>> static inline struct page *find_buddy_page_pfn(struct page *page, >>> unsigned long pfn, unsigned int order, unsigned long *buddy_pfn)= >>> @@ -330,6 +331,9 @@ static inline struct page *find_buddy_page_pfn(st= ruct page *page, >>> unsigned long __buddy_pfn =3D __find_buddy_pfn(pfn, order); >>> struct page *buddy; >>> + if (!pfn_valid(__buddy_pfn)) >>> + return NULL; >>> + >>> buddy =3D page + (__buddy_pfn - pfn); >>> if (buddy_pfn) >>> *buddy_pfn =3D __buddy_pfn; >> -- Best Regards, Yan, Zi --=_MailMate_6C734AB4-0073-4883-BBF7-9D9EA7B17258_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEE6rR4j8RuQ2XmaZol4n+egRQHKFQFAmKyRz8PHHppeUBudmlk aWEuY29tAAoJEOJ/noEUByhUx74P/ix+nL74tRL9PfkZLsUUmoruLkfTJU4qE9dH 7fLFbuy6FWd6WiFfHbn88EN7362hQi6t6zoatU4Nhd16J/6gtbrjeO3jfhNVPBdy 5AGLoBBeHOfBMlTIgM8Fs3lKZH01YAhiUX4Uqll3rN96jhTzHdMEPBpzmLMBZIAU gL2W6S25Dh/A3KG/qompRockRDOI24iDC02gBEm3QVyxrENM0J1RVK6IVhnIo+NU 1igJkRwJPrvxYsg5GRnSjg2OBNt4aLGO/xBqoenLbLQr/s3/3BgteofvZPGMbV5z 7p+0YygVLfPs4t/VTxZYSrId8RJmpdTOlfTTznzixuKPKVWh4Z6JLeIgQE8Thxj6 kT3K6VmH9s5jND3eDCENQcj8zSmSvkIhYk2kVEfciU6rQXXc6xmqgBnd6h8nM4s7 lYnn0KqDAO/HMgJtsIdrIIn++vKF/01sc+IrTaE0WOh7DPMTKXMUEbEMdkoF7qLJ l1tDPPmPbMlp2aUENTsPWEEQNcqeYanuI9SlNS+Gx1LHm58eiHpTxmjn1hr2lPbo EBhlZ82OcRp+f5r73t+rxOgc5qoI93DDTvT2upaKeBmhvZO4sa1vAgYmjsumvayL fuwq58YMHwghzcnZYCS87/Fl4r635SK6nNnkEIp0JADUfVPflG/CsNaCZkb3t9ci teEr/0LM =TjuU -----END PGP SIGNATURE----- --=_MailMate_6C734AB4-0073-4883-BBF7-9D9EA7B17258_=--