Message ID | 20230620140332.30578-1-tsahu@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3721138vqr; Tue, 20 Jun 2023 07:51:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6TApUXsqe9+aE4cXFrg0H+qqMRiJDZf7U7CNXpREXHL7x7pkWY8an9QH2bT45LEilAiUwc X-Received: by 2002:a05:6a20:9187:b0:111:3998:7dd4 with SMTP id v7-20020a056a20918700b0011139987dd4mr8929284pzd.44.1687272674062; Tue, 20 Jun 2023 07:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687272674; cv=none; d=google.com; s=arc-20160816; b=zfj5ojMZ+6gOeWayj50KrRA05yXq6U2ds/AGw/RPWpXeGoPfhLzZfEgGhKQsdAiqkD dPEsxznpiNONIWovwhbwb0GdugFMli+425/paonNUORMmoKAQf2xYxwcsWSyP4upK1Vt iTK5JuB+nOb5nOr/IzcT0JWrgSfUCUuBrqfqz8ylUNYh84EXWeMQFG30BW/OO12h+Unz 7iAWPKProEKRSQib+cppmKtGqIQi37p/2DuwQE8p/lXxS/JLBk8Zd54G5gO1P11uyzM+ o1t5RVF7I7F5ooKqIzfIE8xy2A0DhBnigi4K2D+vclGGfdTtqLAhYm7u99kF2IEeSQmV vS0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7K/xsQqVPbIPN37kjzszKxy8hUlBb8VKcQNWTP2aNZk=; b=e71SEnnSiMSK/yyf541/UuXOfmP23u7Fb/uSuAfvINZN2DTPyOjtP67o9ekTwPzwjr XDs3LQhx7SnFAqTIgk/amBAW4ehLLUiZDH42d288oUk1EnpX9uCFpxw0LrMKZOiRxEQ1 jf5Fnn3Cn0mR5jq8gS7W3zIFx2tsgR5U6wSnuuLdIj2Dt8NtJhF7DKMHh+LUHkIrcGLU qo/sIBkCel3PoAUcl6qN5rwgAs3BuEO+T0PhCcX+54R3IC23SKB0w4NX7TozYv9+ygz0 HYkLBSI0wPPHfC/a2cdByI7xYJfMiFHHX07ku28uXdKnQ1kNE185cRXqgJfHaPcgH0VI yDzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YrRc2nil; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lg7-20020a170902fb8700b001ac6d4e1d72si824090plb.149.2023.06.20.07.50.59; Tue, 20 Jun 2023 07:51:14 -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=@ibm.com header.s=pp1 header.b=YrRc2nil; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233302AbjFTOe7 (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Tue, 20 Jun 2023 10:34:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229932AbjFTOe6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 20 Jun 2023 10:34:58 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E319E10D5; Tue, 20 Jun 2023 07:34:56 -0700 (PDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35KE8kuR006675; Tue, 20 Jun 2023 14:34:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=7K/xsQqVPbIPN37kjzszKxy8hUlBb8VKcQNWTP2aNZk=; b=YrRc2nily0Mxdazm5AXcppS3MolSKDWRYB9SPqjxhConKjAmqcITOIaLIMkc4UTRqRMS EQq/0m0hvWvMyyvNoSCs2J8mFRQtmZLWTLC+xlNXQUJPvm8FnTM7C+muqns5e1WuqYT3 s90yy81hRkoCVZdCJQoltKKjj0kftTtamD3IehyH98VSBN+1UetN7AqIuv5NS10Mavjs EZw8JHECD+5xymvvv+kAsiztbUHwxyGfJ8elhHWv8GCNIYAbGUy+UGbtZd4XgK8P+lil Nmv4TxlWfRZr4nwU2MHBmSgBRFz6/EZAx9kBwykO3jIqnWoBvAfV7DYqBXgiMu8d3PKy dg== Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rbda9sc9v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jun 2023 14:34:38 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35KDl90a030431; Tue, 20 Jun 2023 14:03:40 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3r94f523u3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Jun 2023 14:03:40 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35KE3aUQ23659116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 20 Jun 2023 14:03:36 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD0BE2004B; Tue, 20 Jun 2023 14:03:36 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0A6920040; Tue, 20 Jun 2023 14:03:34 +0000 (GMT) Received: from tarunpc.in.ibm.com (unknown [9.199.157.25]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 20 Jun 2023 14:03:34 +0000 (GMT) From: Tarun Sahu <tsahu@linux.ibm.com> To: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Cc: linux-kernel@vger.kernel.org, dave.jiang@intel.com, dan.j.williams@intel.com, vishal.l.verma@intel.com, aneesh.kumar@linux.ibm.com, jaypatel@linux.ibm.com, tsahu@linux.ibm.com Subject: [PATCH] dax/kmem: Pass valid argument to memory_group_register_static Date: Tue, 20 Jun 2023 19:33:32 +0530 Message-Id: <20230620140332.30578-1-tsahu@linux.ibm.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: HL3Nuj0em6Fb1yUMU-9ZvkkBmytcqfY_ X-Proofpoint-ORIG-GUID: HL3Nuj0em6Fb1yUMU-9ZvkkBmytcqfY_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-20_10,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 impostorscore=0 clxscore=1015 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306200131 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769233631331571438?= X-GMAIL-MSGID: =?utf-8?q?1769233631331571438?= |
Series |
dax/kmem: Pass valid argument to memory_group_register_static
|
|
Commit Message
Tarun Sahu
June 20, 2023, 2:03 p.m. UTC
memory_group_register_static takes maximum number of pages as the argument
while dev_dax_kmem_probe passes total_len (in bytes) as the argument.
Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com>
---
drivers/dax/kmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Jun 20, 2023 at 07:33:32PM +0530, Tarun Sahu wrote: > memory_group_register_static takes maximum number of pages as the argument > while dev_dax_kmem_probe passes total_len (in bytes) as the argument. This sounds like a fix. An explanation of the impact and a fixes tag may be needed. Also, wondering how you found it. Alison > > Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com> > --- > drivers/dax/kmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c > index 7b36db6f1cbd..898ca9505754 100644 > --- a/drivers/dax/kmem.c > +++ b/drivers/dax/kmem.c > @@ -99,7 +99,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) > if (!data->res_name) > goto err_res_name; > > - rc = memory_group_register_static(numa_node, total_len); > + rc = memory_group_register_static(numa_node, PFN_UP(total_len)); > if (rc < 0) > goto err_reg_mgid; > data->mgid = rc; > -- > 2.31.1 >
Hi Alison, Alison Schofield <alison.schofield@intel.com> writes: > On Tue, Jun 20, 2023 at 07:33:32PM +0530, Tarun Sahu wrote: >> memory_group_register_static takes maximum number of pages as the argument >> while dev_dax_kmem_probe passes total_len (in bytes) as the argument. > > This sounds like a fix. An explanation of the impact and a fixes tag > may be needed. Also, wondering how you found it. > Yes, it is a fix, I found it during dry code walk-through. There is not any impact as such. As, memory_group_register_static just set the max_pages limit which is used in auto_movable_zone_for_pfn to determine the zone. which might cause these condition to behave differently, This will be true always so jump will happen to kernel_zone if (!auto_movable_can_online_movable(NUMA_NO_NODE, group, nr_pages)) goto kernel_zone; --- kernel_zone: return default_kernel_zone_for_pfn(nid, pfn, nr_pages); --- Here, In below, zone_intersects compare range will be larger as nr_pages will be higher (derived from total_len passed in dev_dax_kmem_probe). static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn, unsigned long nr_pages) { struct pglist_data *pgdat = NODE_DATA(nid); int zid; for (zid = 0; zid < ZONE_NORMAL; zid++) { struct zone *zone = &pgdat->node_zones[zid]; if (zone_intersects(zone, start_pfn, nr_pages)) return zone; } return &pgdat->node_zones[ZONE_NORMAL]; } In Mostly cases, ZONE_NORMAL will be returned. But there is no crash/panic issues involved here, only decision making on selecting zone is affected. > Alison > >> >> Signed-off-by: Tarun Sahu <tsahu@linux.ibm.com> >> --- >> drivers/dax/kmem.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c >> index 7b36db6f1cbd..898ca9505754 100644 >> --- a/drivers/dax/kmem.c >> +++ b/drivers/dax/kmem.c >> @@ -99,7 +99,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) >> if (!data->res_name) >> goto err_res_name; >> >> - rc = memory_group_register_static(numa_node, total_len); >> + rc = memory_group_register_static(numa_node, PFN_UP(total_len)); >> if (rc < 0) >> goto err_reg_mgid; >> data->mgid = rc; >> -- >> 2.31.1 >>
On Wed, 2023-06-21 at 11:36 +0530, Tarun Sahu wrote: > Hi Alison, > > Alison Schofield <alison.schofield@intel.com> writes: > > > On Tue, Jun 20, 2023 at 07:33:32PM +0530, Tarun Sahu wrote: > > > memory_group_register_static takes maximum number of pages as the argument > > > while dev_dax_kmem_probe passes total_len (in bytes) as the argument. > > > > This sounds like a fix. An explanation of the impact and a fixes tag > > may be needed. Also, wondering how you found it. > > > Yes, it is a fix, I found it during dry code walk-through. > There is not any impact as such. As, > memory_group_register_static just set the max_pages limit which > is used in auto_movable_zone_for_pfn to determine the zone. > > which might cause these condition to behave differently, > > This will be true always so jump will happen to kernel_zone > if (!auto_movable_can_online_movable(NUMA_NO_NODE, group, nr_pages)) > goto kernel_zone; > --- > kernel_zone: > return default_kernel_zone_for_pfn(nid, pfn, nr_pages); > > --- > > Here, In below, zone_intersects compare range will be larger as nr_pages > will be higher (derived from total_len passed in dev_dax_kmem_probe). > > static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn, > unsigned long nr_pages) > { > struct pglist_data *pgdat = NODE_DATA(nid); > int zid; > > for (zid = 0; zid < ZONE_NORMAL; zid++) { > struct zone *zone = &pgdat->node_zones[zid]; > > if (zone_intersects(zone, start_pfn, nr_pages)) > return zone; > } > > return &pgdat->node_zones[ZONE_NORMAL]; > } > > In Mostly cases, ZONE_NORMAL will be returned. But there is no > crash/panic issues involved here, only decision making on selecting zone > is affected. > Hi Tarun, Good find! With a Fixes tag, and perhaps inclusion of a bit more of this detail described in the commit message, feel free to add: Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Hi Vishal, "Verma, Vishal L" <vishal.l.verma@intel.com> writes: > On Wed, 2023-06-21 at 11:36 +0530, Tarun Sahu wrote: >> Hi Alison, >> >> Alison Schofield <alison.schofield@intel.com> writes: >> >> > On Tue, Jun 20, 2023 at 07:33:32PM +0530, Tarun Sahu wrote: >> > > memory_group_register_static takes maximum number of pages as the argument >> > > while dev_dax_kmem_probe passes total_len (in bytes) as the argument. >> > >> > This sounds like a fix. An explanation of the impact and a fixes tag >> > may be needed. Also, wondering how you found it. >> > >> Yes, it is a fix, I found it during dry code walk-through. >> There is not any impact as such. As, >> memory_group_register_static just set the max_pages limit which >> is used in auto_movable_zone_for_pfn to determine the zone. >> >> which might cause these condition to behave differently, >> >> This will be true always so jump will happen to kernel_zone >> if (!auto_movable_can_online_movable(NUMA_NO_NODE, group, nr_pages)) >> goto kernel_zone; >> --- >> kernel_zone: >> return default_kernel_zone_for_pfn(nid, pfn, nr_pages); >> >> --- >> >> Here, In below, zone_intersects compare range will be larger as nr_pages >> will be higher (derived from total_len passed in dev_dax_kmem_probe). >> >> static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn, >> unsigned long nr_pages) >> { >> struct pglist_data *pgdat = NODE_DATA(nid); >> int zid; >> >> for (zid = 0; zid < ZONE_NORMAL; zid++) { >> struct zone *zone = &pgdat->node_zones[zid]; >> >> if (zone_intersects(zone, start_pfn, nr_pages)) >> return zone; >> } >> >> return &pgdat->node_zones[ZONE_NORMAL]; >> } >> >> In Mostly cases, ZONE_NORMAL will be returned. But there is no >> crash/panic issues involved here, only decision making on selecting zone >> is affected. >> > > Hi Tarun, > > Good find! With a Fixes tag, and perhaps inclusion of a bit more of > this detail described in the commit message, feel free to add: > Thanks for reviewing, sent the updated version. > Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index 7b36db6f1cbd..898ca9505754 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -99,7 +99,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) if (!data->res_name) goto err_res_name; - rc = memory_group_register_static(numa_node, total_len); + rc = memory_group_register_static(numa_node, PFN_UP(total_len)); if (rc < 0) goto err_reg_mgid; data->mgid = rc;