Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1373507rwi; Wed, 26 Oct 2022 14:36:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HWDOV7vXLJNXITQ7TWf99ElLO4644qxzG+WqGofKn0EQ85yOOdr+gSe27M0AnFr0kniyp X-Received: by 2002:a05:6402:2681:b0:461:cbda:fe4b with SMTP id w1-20020a056402268100b00461cbdafe4bmr16075251edd.124.1666820172775; Wed, 26 Oct 2022 14:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666820172; cv=none; d=google.com; s=arc-20160816; b=MYzJ3AUWsVWyugkhePqM27YRUE8e8/UkZ03PKTXNHmCUO9C/7dFsuMyHZnuTm1rTbb MKrEFwEk0edsiQseYCCYBqGbBgp79kHQrPcFxBaa9qQZg8G1rg+aIUmpbvItLArsbWeU 1mI7RBEqyivTDLQr+5XLwgIom6xE1rVyD7MyXN/AX4iZJMmTswvWf0ShAtu+CY3hZ/RY GvF1CksXgB2OPv0Bg2TnMEGcksIvgBxzas8ocdnQsj/sseLQ0xNeZZ4XEx0Mt8v9fqKG tpkrldMYQc/qk/ni1V5xcQcc0a8Cc0oMJ7jgLuMuWPn6zHRDaxG+oExsa5IgvgdHX/+Q hIrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Idd0Hb78ztmsONfbOU5aIzBiJwVe7VkMWxVXkQJGGR0=; b=SXQToopOt/Gppjs8yrCeUwJMNoBYKS5IP1cZYCsSpGBjzq4lpeko+X1oeqLcYPtFoX 2E3xa4agRcglEEwjxiaMZNq2Ds1sxryS/4tpqom7LlOQceHVeQIzG1v/kTkY3GLaEYrm QPTzSjLGzS0W9L9J5n1/C/KRN9wnnypHQ5RcLzAYHt6syCkKcjLYXuksRLo597ZiB9Ym RBTLbpEi6z4RWFK+OkjKRwZKmHUu7PqY7oDhJhEGeCtL8z3zX7BFMhrT2ifFeqFaqO0B 6oZNaijd2NPwVtv3w+jEc1iWHelJ4I8vKNdRq4YSQOi+uIuyFENLxoYOOew8J8yR8Q63 Ivzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=DinbMQBI; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020a170906974c00b007ad86fb5914si1044483ejy.917.2022.10.26.14.35.46; Wed, 26 Oct 2022 14:36:12 -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=@soleen.com header.s=google header.b=DinbMQBI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232946AbiJZV33 (ORCPT + 99 others); Wed, 26 Oct 2022 17:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiJZV31 (ORCPT ); Wed, 26 Oct 2022 17:29:27 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 301F0138B8E for ; Wed, 26 Oct 2022 14:29:24 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id a67so43775157edf.12 for ; Wed, 26 Oct 2022 14:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Idd0Hb78ztmsONfbOU5aIzBiJwVe7VkMWxVXkQJGGR0=; b=DinbMQBIydVstQWlIMsTMkASzRhi6Bgsazw851vqWYHRId1tuK0lsLzNSArjgEqwvY CfJwqxIK6JyqkH6Tcus2Gils+S+vzbqCkdOaeM6bJERtjQNsAuWQImrR8L4VpBYuMGoE CIgSmKIqLEhmop7RoF+9wNri5oDiQAl5VFZkkOU9zrJnvz3UiXXaOWaVOu6FycxEcFPk ePm0XIT6cCOufWh5GTYrZkjSuRf34KFfVAswUwrtsj/V/4ZIa6R7ES72DEcwE300g0Ox VGR6WVxQuexAlcYhyr8Wa2DiK31AJ2S22HIcIV1D/dTE8ufsd2qQ0PLJDtjneK5tD1dy MIjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=Idd0Hb78ztmsONfbOU5aIzBiJwVe7VkMWxVXkQJGGR0=; b=oKdfUQnzzehrdc0SseEKzgRnoGXAJE/cvIAptk4Q77MrhnlAjk5Oqn0JXgBU9urF4N qmSc8krJq3KjStakphVIlKApORx6MWORncUIqRShYbAvDs/+CXf4X7RqitxIDUq6f/XE ySWgiO4L+Vg878SZCJnVX+naYDwC7srlcpDDtWdhN5MMbLH6zNv/1X1rMvqFjKuEuQsk OSpQMzzp9Wxt2QHmJJdr0qNiZg295DhRu0M7MwUSaEUv6xZgz6OFNaWd6V9FxRv5Hv6r ZrK+G85jbZCyghZOZKRMUR0cgGziE51RoKZmxyOD6OFjtwbi9TX5gUMjKhTlmZ63bP4e 7SLQ== X-Gm-Message-State: ACrzQf2adlrKx4eKJlYwqq2V3Dfz6fln9xemZH+Tm+07Favj+izg4sfR iqwIw7Vpj1ymsL8px/AlRs5J9w8MERVKjxIS7PDyoA== X-Received: by 2002:a05:6402:26ca:b0:462:7f27:a0dd with SMTP id x10-20020a05640226ca00b004627f27a0ddmr2075991edd.132.1666819762711; Wed, 26 Oct 2022 14:29:22 -0700 (PDT) MIME-Version: 1.0 References: <20221017171118.1588820-1-sammler@google.com> In-Reply-To: <20221017171118.1588820-1-sammler@google.com> From: Pasha Tatashin Date: Wed, 26 Oct 2022 17:28:45 -0400 Message-ID: Subject: Re: [PATCH v1] virtio_pmem: populate numa information To: Michael Sammler Cc: Pankaj Gupta , Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 On Mon, Oct 17, 2022 at 1:11 PM Michael Sammler wrote: > > Compute the numa information for a virtio_pmem device from the memory > range of the device. Previously, the target_node was always 0 since > the ndr_desc.target_node field was never explicitly set. The code for > computing the numa node is taken from cxl_pmem_region_probe in > drivers/cxl/pmem.c. > > Signed-off-by: Michael Sammler Enables the hot-plugging of virtio-pmem memory into correct memory nodes. Does not look like it effect the FS_DAX. Reviewed-by: Pasha Tatashin Thanks, Pasha > --- > drivers/nvdimm/virtio_pmem.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvdimm/virtio_pmem.c b/drivers/nvdimm/virtio_pmem.c > index 20da455d2ef6..a92eb172f0e7 100644 > --- a/drivers/nvdimm/virtio_pmem.c > +++ b/drivers/nvdimm/virtio_pmem.c > @@ -32,7 +32,6 @@ static int init_vq(struct virtio_pmem *vpmem) > static int virtio_pmem_probe(struct virtio_device *vdev) > { > struct nd_region_desc ndr_desc = {}; > - int nid = dev_to_node(&vdev->dev); > struct nd_region *nd_region; > struct virtio_pmem *vpmem; > struct resource res; > @@ -79,7 +78,15 @@ static int virtio_pmem_probe(struct virtio_device *vdev) > dev_set_drvdata(&vdev->dev, vpmem->nvdimm_bus); > > ndr_desc.res = &res; > - ndr_desc.numa_node = nid; > + > + ndr_desc.numa_node = memory_add_physaddr_to_nid(res.start); > + ndr_desc.target_node = phys_to_target_node(res.start); > + if (ndr_desc.target_node == NUMA_NO_NODE) { > + ndr_desc.target_node = ndr_desc.numa_node; > + dev_dbg(&vdev->dev, "changing target node from %d to %d", > + NUMA_NO_NODE, ndr_desc.target_node); > + } > + > ndr_desc.flush = async_pmem_flush; > ndr_desc.provider_data = vdev; > set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); > -- > 2.38.0.413.g74048e4d9e-goog