Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9C6DC07E96 for ; Thu, 15 Jul 2021 09:42:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB17F613BA for ; Thu, 15 Jul 2021 09:42:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232269AbhGOJpU (ORCPT ); Thu, 15 Jul 2021 05:45:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58186 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbhGOJpT (ORCPT ); Thu, 15 Jul 2021 05:45:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626342146; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4PdOfMSnG9LJU18W2DtAkqVS77pNiWqr5hxkOihWpm0=; b=gRgFDNxfhUWL5CnIjetV6CTPYtIkNNb8wzRGAJ1ypWXAo+NpwQOnWjVEIBCADqRU2nF5Iw BWcHdGDUHASueFrCh1YORvGrYTeyEebuHq/nGh9LMr1e1NBQR/Gzt6F9zxlUtQnjDIfbkD Cn9DvcHuWP/QqdcK3Q8RQdjwluz+FQw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-NJF9Z1CtO3Kt3N_FYJD43g-1; Thu, 15 Jul 2021 05:42:25 -0400 X-MC-Unique: NJF9Z1CtO3Kt3N_FYJD43g-1 Received: by mail-wr1-f71.google.com with SMTP id h11-20020adffa8b0000b029013a357d7bdcso3038257wrr.18 for ; Thu, 15 Jul 2021 02:42:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=4PdOfMSnG9LJU18W2DtAkqVS77pNiWqr5hxkOihWpm0=; b=WXXKSmP3Z/Dw+JjUU9KbdggEldoAi7U1zuRoe00E2r5COC3kfVxeMSpDFWoOqALoun EySTTsCkBP7lXbRz7ST8TXlRsZmj6UjCQXNAw9075PbJFMpc2Dir1LhxXk0oZgmxHCGe GKFwsAnTcmWceJspBkit4NQ9t/U+5bSdtDVePT/Yg2g8B5AutC2gdfNUkIMZPLWpYdtQ bJvfbH4a3SfSpi8ar0JsliK1UgN5BKY6lNHBGwsHK/bVbj90DQv1xmpkQcqHj22hXna2 loJktqLBLxIo+3OrP67ogoAXlPgP14L9RJocsTyrJw92AVw3ls3uWSZfWcuTGzXV81TW d+jA== X-Gm-Message-State: AOAM532xHGfKFTUYPHc9ROJJn4Y1/eOcOZ1OkuATtWc7v4C0aOmBL/xz vksoPzeu7Zfq11JhGNSYxlTYvPQTBiIKmQE3Atkipqnt+CXvOTNDdfS7tVbZqDCQTy2BLpitIko 20BY/5HVRoGCjNTY8eSTQuQ== X-Received: by 2002:a1c:4e18:: with SMTP id g24mr3536110wmh.175.1626342144022; Thu, 15 Jul 2021 02:42:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAXwE/gJvtgWH3VbzGQK7W3cyGE+l9fkhB4QJqLvhmzLWnJPkHReE1uIFCe9c8tBBrApBQSg== X-Received: by 2002:a1c:4e18:: with SMTP id g24mr3536099wmh.175.1626342143837; Thu, 15 Jul 2021 02:42:23 -0700 (PDT) Received: from [192.168.3.132] (p4ff23bb3.dip0.t-ipconnect.de. [79.242.59.179]) by smtp.gmail.com with ESMTPSA id q5sm4533504wmc.0.2021.07.15.02.42.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Jul 2021 02:42:23 -0700 (PDT) To: Heiko Carstens , Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Vitaly Kuznetsov , "Michael S. Tsirkin" , Jason Wang , Pankaj Gupta , Wei Yang , Oscar Salvador , Michal Hocko , Dan Williams , Anshuman Khandual , Dave Hansen , Vlastimil Babka , Mike Rapoport , "Rafael J. Wysocki" , Len Brown , Pavel Tatashin , Michael Ellerman , Catalin Marinas , virtualization@lists.linux-foundation.org, linux-acpi@vger.kernel.org, Andy Lutomirski , "Aneesh Kumar K.V" , Anton Blanchard , Ard Biesheuvel , Baoquan He , Benjamin Herrenschmidt , Borislav Petkov , Christian Borntraeger , Christophe Leroy , Dave Jiang , "H. Peter Anvin" , Ingo Molnar , Jia He , Joe Perches , Kefeng Wang , Laurent Dufour , Michel Lespinasse , Nathan Lynch , Nicholas Piggin , Paul Mackerras , Peter Zijlstra , Pierre Morel , "Rafael J. Wysocki" , Rich Felker , Scott Cheloha , Sergei Trofimovich , Thiago Jung Bauermann , Thomas Gleixner , Vasily Gorbik , Vishal Verma , Will Deacon , Yoshinori Sato References: <20210712124052.26491-1-david@redhat.com> <20210712124052.26491-2-david@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1 1/4] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() Message-ID: <99c59db8-4c3d-6bee-9acc-41a8f76899ef@redhat.com> Date: Thu, 15 Jul 2021 11:42:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On 14.07.21 22:13, Heiko Carstens wrote: > On Mon, Jul 12, 2021 at 02:40:49PM +0200, David Hildenbrand wrote: >> Checkpatch complained on a follow-up patch that we are using "unsigned" >> here, which defaults to "unsigned int" and checkpatch is correct. >> >> Use "unsigned long" instead, just as we do in other places when handling >> PFNs. This can bite us once we have physical addresses in the range of >> multiple TB. >> >> Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering") >> Signed-off-by: David Hildenbrand >> --- >> include/linux/memory_hotplug.h | 4 ++-- >> mm/memory_hotplug.c | 4 ++-- >> 2 files changed, 4 insertions(+), 4 deletions(-) > > I'd propose to add Cc: since I actually had > the fun to try to debug something like this a couple of years ago: > 6cdb18ad98a4 ("mm/vmstat: fix overflow in mod_zone_page_state()") > Good point, and thinking again what can go wrong, I tend to agree. We are trying to keep zones contiguous and it could happen that we end up with something like ZONE_DMA here (via default_kernel_zone_for_pfn()) and would consequently online something to ZONE_DMA that doesn't belong there, resulting in crashes. @Andrew can you add Cc: and "As we will search for a fitting zone using the wrong pfn, we might end up onlining memory to one of the special kernel zones, such as ZONE_DMA, which can end badly as the onlined memory does not satisfy properties of these zones." Thanks Heiko! -- Thanks, David / dhildenb