Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp614204rwi; Wed, 26 Oct 2022 05:16:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FzTVZaJ2izoqkZshT//gGEX7R8vwZycDkE0T7WlYcuTDTmzH0nMteOwOMMP1JaNHgsUZp X-Received: by 2002:a17:906:65c6:b0:73c:8897:65b0 with SMTP id z6-20020a17090665c600b0073c889765b0mr37597648ejn.322.1666786551173; Wed, 26 Oct 2022 05:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666786551; cv=none; d=google.com; s=arc-20160816; b=Y0HEIU75JcE6glHmiBGj+/nAALf6CyLZULe9mKRZ4RfC/wYGGcgl3AOuup4vmUOs6Q dbs5IWjgNFz8+txVaMW1wgn5emCkiCgHOt1JBnMHtBib6skIHFcjr+xKl9sEKrmSee10 NAgKk1Dht4ADw8+x23YzXOOYmdeEy3E5vHhWyDnahIn5eoaVuR+DACN4H9jqDQA+5vjU SmLo2/JYNpnLHPwhyTjGi0Ofm+fokYThkygpSDgfXLJn9ZBSoPUkfxG3vY/cZl3GRqC7 FaC6UlB3AE67rJUFRvAYZ3Yo8r3wWKGfGV+s7dvB+xl31S+C1tI0K2rZDB99yvKGGfht ut0A== 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=vZ5aSZWWIhIFIjTByURiHqOWXy1GxsKS3NVs264EAr8=; b=00ecA4hQXX0d7E9YtGvJvjQ1XJLukWPwnOdc6XQY3AJSIttIRALoWk+wpoLz17Dw54 zLnwX30vTpBoAN2FBdy+tl6L6PCSs02pt20wHH2MycZDPkpLFbBL4/i9VOUe6GdIeb6p REiZeDLBsF/qeTCF/HENxnyRquHarFf9P7c4lMt6KH0yc7EzQgZtOL+uiICad27SbNpH BmxgHnrsTn1hVR1rHbG+VBcNFw0qpurqDlCddCK5OOSVBHIbdDAIAgc/LarCnkJPeYBP q5uyiP5LHNcmHxUEiXQbdDTmqaGQvV6Gnfm4/G5ACFOduohR3s6NpodUVFBsWybxe8Xt ckCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oXfPzt0J; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb42-20020a170907962a00b007707ab4be28si5846459ejc.972.2022.10.26.05.15.24; Wed, 26 Oct 2022 05:15:51 -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=@gmail.com header.s=20210112 header.b=oXfPzt0J; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233831AbiJZMM4 (ORCPT + 99 others); Wed, 26 Oct 2022 08:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233446AbiJZMMd (ORCPT ); Wed, 26 Oct 2022 08:12:33 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E922C2D747 for ; Wed, 26 Oct 2022 05:12:31 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id g10so18166466oif.10 for ; Wed, 26 Oct 2022 05:12:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vZ5aSZWWIhIFIjTByURiHqOWXy1GxsKS3NVs264EAr8=; b=oXfPzt0JJzEiYPmp6/UVl3QESY5eYmPMyk1PUXcPsx5TkKA1luR3mwvzMiHsFdGkuw lFH6H1yHTH3ixTKPoCmMNQ4zmAp75XjW8TEArvQQcC9hfXaPtgUUlj1DryJcJiA3nJ+W cgnd9b+7zJ5sW07GpsYxTQ9nhqXaUOiY7d1M26nHfsv7Cr8ofV5LDZayI7aSrq/ruofN D9sxcxBlcJsoCSj/b9SDSbyoFg2D1P3keAyRtLQMECLOm6SnKgknqsy0ty6kzKJ1ys76 UuRzGDlMsZauVIIEb8m9Do0erpzGPXdpUdcsyaPfqdbcpnUagMxNHH8ihhphMM3USBN5 c7Qg== 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=vZ5aSZWWIhIFIjTByURiHqOWXy1GxsKS3NVs264EAr8=; b=ExlsU40ItqdvP/Ntxf0UZFyhWvY9NRPPngN/2yGPqMXPUCFrxjF3lt4xBEjNY76Mhc UaUtM52GTZLEfKZi/n4nC7zNOBxdCQ5xHjTIH/dpp/U+5wWhHA5W4VsvnpbUHEnw2eIE 04qrIcIj1+rI3nMcWuujGqF6Z0AtPn+dSYTh9n6R3c7kMp19rPcTTvw4aKH1seXX6UEl MHNbycEDLgh+3ejkzupHxCuMX+khzHOk8eKhO4eOiw5q1xmuW6/jRMS7tfGEBHQM1azr WCG6oam/GFGd6j/PEMKg0Rk8sSpOLREA4qpm/O/PLsqf6e+dYHbehiPrcdAMc6wxzmEK Ix1g== X-Gm-Message-State: ACrzQf3eAajIWfaYaoNHUxtDcSdQWpgGJyaYVbrD1uaBWHbAoDzmyeq5 aoVz8R8GbXA5jIwFSgMHHr/6+QrZ6q1ZJpvCmcLJzL+/dE0= X-Received: by 2002:a05:6808:f93:b0:355:29b1:c2a1 with SMTP id o19-20020a0568080f9300b0035529b1c2a1mr1666878oiw.297.1666786351235; Wed, 26 Oct 2022 05:12:31 -0700 (PDT) MIME-Version: 1.0 References: <20221017171118.1588820-1-sammler@google.com> In-Reply-To: From: Pankaj Gupta Date: Wed, 26 Oct 2022 14:12:20 +0200 Message-ID: Subject: Re: [PATCH v1] virtio_pmem: populate numa information To: Michael Sammler Cc: Dan Williams , Vishal Verma , Dave Jiang , Ira Weiny , Pasha Tatashin , 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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 > > > 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 > > > --- > > > 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); > > > + } > > > > As this memory later gets hotplugged using "devm_memremap_pages". I don't > > see if 'target_node' is used for fsdax case? > > > > It seems to me "target_node" is used mainly for volatile range above > > persistent memory ( e.g kmem driver?). > > > I am not sure if 'target_node' is used in the fsdax case, but it is > indeed used by the devdax/kmem driver when hotplugging the memory (see > 'dev_dax_kmem_probe' and '__dax_pmem_probe'). Yes, but not currently for FS_DAX iiuc. Thanks, Pankaj