Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp6079971rdb; Mon, 18 Sep 2023 03:41:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTRBlC1v7iRdYropDjR23qhDXSmLag7qwt8xn2jZFucY+4FCXwIqASLciMyEV1fIlgfpy0 X-Received: by 2002:a05:6a21:620:b0:157:c14e:1d00 with SMTP id ll32-20020a056a21062000b00157c14e1d00mr8704071pzb.58.1695033700830; Mon, 18 Sep 2023 03:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695033700; cv=none; d=google.com; s=arc-20160816; b=tCD/eZUCXYXBSYelEPfjdSrI7W3U+8YMGfcn6sOkiHPMDVXXi62o5pXNKrpYKLWecK 73nnSDufjaxx3qlRvnVg7hEKeud8a2ZtpHK+9w8XfYP6kAL97PzUrH23VV4o1WIOh9e5 2iqQbp+YwtFlyvQXkglhEU9dbSE6oKHQKOcFkrVi0IxLLXlH9gxY5FB06BbHGA6lq/9T AtNb161kQJWUUdeWgL44Nq0FLIJiZYyleE9V3GBqMcBGEgMZgyCU1NPnbqhWIlIrW6LX PKh6oB3QTG3/9SiU1oE9cWTuSvs6IuQLeTOTIQo5Aez/rouCs4R7jOd5x449dvPosTQw 44Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=lc875+/om9fvJ1d9pOiGTD2DVYmwkW+SYXvbiobNitE=; fh=mT5y9WzRxFNgiwLBXLcnfGCg/IN7/RzkNbaHR3kkHP4=; b=ynkN1XBY3n7go+XUBmcMp09pz1hsyEPibn6HgtA+AISYVExp3biMfbj3b7zvWOtjRe VK1WGUBQmSHEe+3Z1tvUu3Qxf09iqwqq6bGjb1rl7ylM2ITHiZiNhO6/nQatf7loZKEk X6hCi2he3v9GM2yZJrO13AxZ7QM8bY4sVpn7qkh0E69TAuS7cav91iS9pplESfI+n3Pv JPpoO6wjVCMKfgC/44CB2A5qsdnTTOkAyfmdiuHyIj9FNWBetK9+WF0cuj11Lu/jkehe 0dHNNGcR74iGIg7nFZkHqHx+oQ8zcmITaAl5wvxcGC/Zz+CAr5330EgbFPMrc0wlYEu5 ARjQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x14-20020a170902ec8e00b001c427a74e31si6161666plg.628.2023.09.18.03.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 03:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 4420C8145957; Mon, 18 Sep 2023 03:31:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241234AbjIRKb1 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 18 Sep 2023 06:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241367AbjIRKbT (ORCPT ); Mon, 18 Sep 2023 06:31:19 -0400 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA163DB; Mon, 18 Sep 2023 03:31:13 -0700 (PDT) Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5711d5dac14so1115020eaf.0; Mon, 18 Sep 2023 03:31:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695033073; x=1695637873; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ErCjYPZb5R42qd/bAiuaTdy6BusCKRPj6SWml5/mG+w=; b=kYiCcVp5Qfeq7r0DFhe/6Da+Ib83s9UHWbz6MoSQUpPgbkX+SRhpPukmTwRX+/gMtU kVrfTK6/r4Elb8+JhHKTxDB1un+3RRtVS2lmSjh2gOybBqJQcYARfBHNmbNlQpQjztlq dvlheDfXPZ6ndOpY1RNziS64B4H5i179+CYcIZ6wceOQq+pL6KpPUWFPXnHn9rHnGFLA 8tq95clpBE+LtXQQyKUrPqP2qf2Q3AXpxvHYPCjmxwUIXMbWDj5JM8E9iuKWRFE0FeuR wmgd+PqruiacRX8VjJ2SvU8lRgVkYUwIKZV7OnkHcLJM3kZKFa+vZtNN4FgfFbDeiqHD Myag== X-Gm-Message-State: AOJu0YzyRIr0QKOsRpkSr5Iv/MAlG9iJQ3t02I89ZVK5hEgmza/6J46r U0C8KgNfzUB8pfRxwOn3a0pb9idPqRmJWbonhbQ= X-Received: by 2002:a4a:b483:0:b0:578:a06a:5d8f with SMTP id b3-20020a4ab483000000b00578a06a5d8fmr7599276ooo.1.1695033073091; Mon, 18 Sep 2023 03:31:13 -0700 (PDT) MIME-Version: 1.0 References: <20230914213148.3560-1-guojinhui.liam@bytedance.com> In-Reply-To: <20230914213148.3560-1-guojinhui.liam@bytedance.com> From: "Rafael J. Wysocki" Date: Mon, 18 Sep 2023 12:30:58 +0200 Message-ID: Subject: Re: [PATCH v5] driver core: platform: set numa_node before platform_add_device() To: Jinhui Guo Cc: rafael@kernel.org, lenb@kernel.org, gregkh@linuxfoundation.org, lizefan.x@bytedance.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel test robot Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 18 Sep 2023 03:31:56 -0700 (PDT) On Thu, Sep 14, 2023 at 11:32 PM Jinhui Guo wrote: > > platform_add_device() According to "git grep" this function is not present in 6.6-rc2. If you mean platform_device_add(), please update the patch subject and changelog accordingly. > creates the numa_node attribute of sysfs according > to whether dev_to_node(dev) is equal to NUMA_NO_NODE. So set the numa node > of device before creating numa_node attribute of sysfs. It would be good to also say that this needs to be done in platform_device_register_full(), because that's where the platform device object is allocated. However, what about adding the NUMA node information to pdevinfo? It would be more straightforward to handle it then AFAICS. > Fixes: 4a60406d3592 ("driver core: platform: expose numa_node to users in sysfs") > Cc: stable@vger.kernel.org > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202309122309.mbxAnAIe-lkp@intel.com/ > Signed-off-by: Jinhui Guo > --- > V4 -> V5: Add Cc: stable line and changes from the previous submited > patches > V3 -> V4: Refactor code to be an ACPI function call > V2 -> V3: Fix Signed-off name > V1 -> V2: Fix compile error without enabling CONFIG_ACPI > > drivers/acpi/acpi_platform.c | 4 +--- > drivers/base/platform.c | 1 + > include/linux/acpi.h | 5 +++++ > 3 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c > index 48d15dd785f6..adcbfbdc343f 100644 > --- a/drivers/acpi/acpi_platform.c > +++ b/drivers/acpi/acpi_platform.c > @@ -178,11 +178,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..35c891075d95 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -841,6 +841,7 @@ struct platform_device *platform_device_register_full( > goto err; > } > > + set_dev_node(&pdev->dev, ACPI_NODE_GET(ACPI_COMPANION(&pdev->dev))); > ret = platform_device_add(pdev); > if (ret) { > err: > diff --git a/include/linux/acpi.h b/include/linux/acpi.h > index a73246c3c35e..6a349d53f19e 100644 > --- a/include/linux/acpi.h > +++ b/include/linux/acpi.h > @@ -477,6 +477,10 @@ static inline int acpi_get_node(acpi_handle handle) > return 0; > } > #endif > + > +#define ACPI_NODE_GET(adev) ((adev) && (adev)->handle ? \ > + acpi_get_node((adev)->handle) : NUMA_NO_NODE) > + > extern int pnpacpi_disabled; > > #define PXM_INVAL (-1) > @@ -770,6 +774,7 @@ const char *acpi_get_subsystem_id(acpi_handle handle); > #define ACPI_COMPANION_SET(dev, adev) do { } while (0) > #define ACPI_HANDLE(dev) (NULL) > #define ACPI_HANDLE_FWNODE(fwnode) (NULL) > +#define ACPI_NODE_GET(adev) NUMA_NO_NODE > > #include > > -- > 2.20.1 >