Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp850367rdb; Tue, 19 Sep 2023 12:02:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNwahzJQSMeoO3I7KNeFOe00gttqCtxX74K2W+az7xgJYHzG0VDFfVcXQr+W6INs6CQYW/ X-Received: by 2002:a05:6a20:f395:b0:14c:d105:2d0c with SMTP id qr21-20020a056a20f39500b0014cd1052d0cmr379388pzb.32.1695150172098; Tue, 19 Sep 2023 12:02:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695150172; cv=none; d=google.com; s=arc-20160816; b=D2GpfxBszuJ3eaGFHR7yRE8ayxyrmoPohLr/xXukjWRn8YIBMYrxuyTBD7TfbGsyVC KQ1heq/kYDeY48xAaJFTU9g55z/x/Wpjf04HeSHmmjp5P5cWG9Y8//OBHFm0CVILEuZT 3LHzjHAtttQxlw95/4plcReKukMeU457dfFO7SYOGpr4yBc+LNFT1tgjUVru4vuSDTYw RDYJHplYSopQ3iJoKAFldr5EYfsbrUlI+UbHWqSuj+ZpLrqFKTxLIEXbZFvkY/qqbeGJ t06MUmC5f3B4oDJD6DudFMWYIyIP6WSxlZSE7c+WNiGszaR5xqTPQ+WhzLE5UCkZ3Uqh i4SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/gIH6CcIzK2WMpH1ZJG8kp4kk8HIcSbDm3GhmtIHuAw=; fh=zr9UYAc+4YTmFiaA4OKVVDKe0/h9ff9Jz3onFjO1ZKI=; b=irVq5zcIuAOJhHMTuB0U2igd0nLfdw7sUy84uSyS28PBTJpaHOOrWCl/2kqw2A+LOm CSFZhCeVfh7z0OLIO/gYwNPSTj9mOOWPbSt82TUCEzWl8we1cMStadAWm70tZqPSM04q A2FE5dU98DEVwLdm8lSrdxxDZJ4nTMkTr2jH3sVdsIUMY4xvrovBlxRTxqz4jg/VoAf3 pcpQ1IIWQG8Mqm3mYQFouPQfQCJoHWXMqiv31t3TcBvkY3RTAxkKefsnY6p/3ui8ASuj 08YT5GzwuaqaONQswNALsPY8ttqaBWXfSKSIzBDT+DAEXg5j0Yf4B5qA/n1qqNvyyK0y zUBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gp9KXJK4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id cp18-20020a056a00349200b0068730bad69bsi10165157pfb.305.2023.09.19.12.02.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 12:02:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gp9KXJK4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3418180A9E0D; Tue, 19 Sep 2023 05:12:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbjISMMb (ORCPT + 99 others); Tue, 19 Sep 2023 08:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjISMM3 (ORCPT ); Tue, 19 Sep 2023 08:12:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08A3E3; Tue, 19 Sep 2023 05:12:23 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDD00C433C9; Tue, 19 Sep 2023 12:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695125543; bh=AFPLIFGXLWjw+0e/AtMKe0zpKJuMhC228OrlJTVOcQc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gp9KXJK4C9ujRIw+cq2kcj4fiAyk6Wt2bWZex8pIQqKeJc/8Y6j1fny3ip6k00TAb L0XgEGURDvrztnTp1aW9mOvmA7mdp9ut9SeM93uwevpZfUDpRhfPGLKryS1Nr+imm1 1QNPk2KkEpIV4ufXanEsSA6zbytT4M6vtIcZs5qo= Date: Tue, 19 Sep 2023 14:12:20 +0200 From: Greg KH To: Jinhui Guo Cc: rafael@kernel.org, lenb@kernel.org, lizefan.x@bytedance.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel test robot Subject: Re: [PATCH v7] driver core: platform: set numa_node before platform_device_add() Message-ID: <2023091942-punk-naturist-8028@gregkh> References: <20230919120341.533-1-guojinhui.liam@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230919120341.533-1-guojinhui.liam@bytedance.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 19 Sep 2023 05:12:31 -0700 (PDT) On Tue, Sep 19, 2023 at 08:03:41PM +0800, Jinhui Guo wrote: > Setting the devices' numa_node needs to be done in > platform_device_register_full(), because that's where the > platform device object is allocated. > > Fixes: 4a60406d3592 ("driver core: platform: expose numa_node to users in sysfs") > Cc: stable@vger.kernel.org > Reported-by: kernel test robot The test robot did not report the original problem, that was a problem with your potential change. > Closes: https://lore.kernel.org/oe-kbuild-all/202309122309.mbxAnAIe-lkp@intel.com/ Likewise, this is not a real issue, it was a problem with your previous submission. > Signed-off-by: Jinhui Guo > --- > V6 -> V7 > 1. Fix bug directly by adding numa_node to struct > platform_device_info (suggested by Rafael J. Wysocki). > 2. Remove reviewer name. > > V5 -> V6: > 1. Update subject to correct function name platform_device_add(). > 2. Provide a more clear and accurate description of the changes > made in commit (suggested by Rafael J. Wysocki). > 3. Add reviewer name. > > V4 -> V5: > Add Cc: stable line and changes from the previous submited patches. > > V3 -> V4: > Refactor code to be an ACPI function call (suggested by Greg Kroah-Hartman). > > V2 -> V3: > Fix Signed-off name. > > V1 -> V2: > Fix compile error without enabling CONFIG_ACPI. > --- > > drivers/acpi/acpi_platform.c | 5 ++--- > drivers/base/platform.c | 4 ++++ > include/linux/platform_device.h | 26 ++++++++++++++++++++++++++ > 3 files changed, 32 insertions(+), 3 deletions(-) > > diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c > index 48d15dd785f6..1ae7449f70dc 100644 > --- a/drivers/acpi/acpi_platform.c > +++ b/drivers/acpi/acpi_platform.c > @@ -168,6 +168,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, > pdevinfo.num_res = count; > pdevinfo.fwnode = acpi_fwnode_handle(adev); > pdevinfo.properties = properties; > + platform_devinfo_set_node(&pdevinfo, acpi_get_node(adev->handle)); > > if (acpi_dma_supported(adev)) > pdevinfo.dma_mask = DMA_BIT_MASK(32); > @@ -178,11 +179,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, > if (IS_ERR(pdev)) > dev_err(&adev->dev, "platform device creation failed: %ld\n", > PTR_ERR(pdev)); > - else { > - set_dev_node(&pdev->dev, acpi_get_node(adev->handle)); > + else > dev_dbg(&adev->dev, "created platform device %s\n", > dev_name(&pdev->dev)); > - } > > kfree(resources); > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index 76bfcba25003..c733bfb26149 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -808,6 +808,7 @@ struct platform_device *platform_device_register_full( > { > int ret; > struct platform_device *pdev; > + int numa_node = platform_devinfo_get_node(pdevinfo); > > pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id); > if (!pdev) > @@ -841,6 +842,9 @@ struct platform_device *platform_device_register_full( > goto err; > } > > + if (numa_node >= 0) > + set_dev_node(&pdev->dev, numa_node); Why not just always set it? Why check? Would that matter? > + > ret = platform_device_add(pdev); > if (ret) { > err: > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h > index 7a41c72c1959..78e11b79f1af 100644 > --- a/include/linux/platform_device.h > +++ b/include/linux/platform_device.h > @@ -132,10 +132,36 @@ struct platform_device_info { > u64 dma_mask; > > const struct property_entry *properties; > + > +#ifdef CONFIG_NUMA > + int numa_node; /* NUMA node this platform device is close to plus 1 */ > +#endif Why #ifdef? And why an int? And why +1? And what do you mean by "close to"? And why would a platform device care about a numa node? These are devices that should NEVER care about numa things as they are not on a real bus, or should care about performance things. If they are, then the device is on the wrong bus, right? What device are you having numa problems with? Why would acpi devices care? The node number in the device itself should be all that you need here, no need to duplicate it, right? thanks, greg k-h