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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76FD1C433FE for ; Tue, 2 Nov 2021 14:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EBCE6109D for ; Tue, 2 Nov 2021 14:35:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230518AbhKBOiK (ORCPT ); Tue, 2 Nov 2021 10:38:10 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47262 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbhKBOiI (ORCPT ); Tue, 2 Nov 2021 10:38:08 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 01AD41FD4E; Tue, 2 Nov 2021 14:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635863733; h=from:from:reply-to: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=PZOYwTcs/uRKNYMtgWTyKzvzPAmp2lHm06+rRoOs/v4=; b=vQq48Hi9tmkUX4nm9Wzk1Fq+ApGIlZIIZmmiD9SmLhgmExEVMaSiVApTakHz0HYqIqdy44 Ot3l2rxUuQ7ce7mmLPELGfrb1s4WWwDEC6Qn5wpi/v7GoGi94FHMUVj3KQTFdyyJYzllRl zjCzO1aYk947DkoYQKmzAyuTUh3hwbM= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id B4221A3B87; Tue, 2 Nov 2021 14:35:32 +0000 (UTC) Date: Tue, 2 Nov 2021 15:35:32 +0100 From: Michal Hocko To: Oscar Salvador Cc: David Hildenbrand , Alexey Makhalov , "linux-mm@kvack.org" , Andrew Morton , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Oscar Salvador Subject: Re: [PATCH] mm: fix panic in __alloc_pages Message-ID: References: <42abfba6-b27e-ca8b-8cdf-883a9398b506@redhat.com> <20211102135201.GA4348@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211102135201.GA4348@linux> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 02-11-21 14:52:01, Oscar Salvador wrote: > On Tue, Nov 02, 2021 at 02:25:03PM +0100, Michal Hocko wrote: > > I think we want to learn how exactly Alexey brought that cpu up. Because > > his initial thought on add_cpu resp cpu_up doesn't seem to be correct. > > Or I am just not following the code properly. Once we know all those > > details we can get in touch with cpu hotplug maintainers and see what > > can we do. > > I am not really familiar with CPU hot-onlining, but I have been taking a look. > As with memory, there are two different stages, hot-adding and onlining (and the > counterparts). > > Part of the hot-adding being: > > acpi_processor_get_info > acpi_processor_hotadd_init > arch_register_cpu > register_cpu > > One of the things that register_cpu() does is to set cpu->dev.bus pointing to > &cpu_subsys, which is: > > struct bus_type cpu_subsys = { > .name = "cpu", > .dev_name = "cpu", > .match = cpu_subsys_match, > #ifdef CONFIG_HOTPLUG_CPU > .online = cpu_subsys_online, > .offline = cpu_subsys_offline, > #endif > }; > > Then, the onlining part (in case of a udev rule or someone onlining the device) > would be: > > online_store > device_online > cpu_subsys_online > cpu_device_up > cpu_up > ... > online node > > Since Alexey disabled the udev rule and no one onlined the CPU, online_store()-> > device_online() wasn't really called. > > The following only applies to x86_64: > I think we got confused because cpu_device_up() is also called from add_cpu(), > but that is an exported function and x86 does not call add_cpu() unless for > debugging purposes (check kernel/torture.c and arch/x86/kernel/topology.c). > It does the onlining through online_store()... > So we can take add_cpu() off the equation here. Yes, so the real problem is (thanks for pointing me to the acpi code). The cpu->node association is done in acpi_map_cpu2node and I suspect this expects that the node is already present as it gets the information from SRAT/PXM tables which are parsed during boot. But I might be just confused or maybe just VMware inject new entries here somehow. Another interesting thing is that acpi_map_cpu2node skips over association if there is no node found in SRAT but that should only mean it would use the default initialization which should be hopefuly 0. Anyway, I have found in my notes https://www.spinics.net/lists/kernel/msg3010886.html which is a slightly different problem but it has some notes about how the initialization mess works (that one was boot time though and hotplug might be different actually). I have ran out of time for this today so hopefully somebody can re-learn that from there... -- Michal Hocko SUSE Labs