From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 900FCC3DA59 for ; Fri, 19 Jul 2024 14:39:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9E8F6B0082; Fri, 19 Jul 2024 10:39:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D28F06B0083; Fri, 19 Jul 2024 10:39:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC8336B0088; Fri, 19 Jul 2024 10:39:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9EA446B0082 for ; Fri, 19 Jul 2024 10:39:04 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0E10AA29AA for ; Fri, 19 Jul 2024 14:39:04 +0000 (UTC) X-FDA: 82356759408.17.976767F Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf12.hostedemail.com (Postfix) with ESMTP id 5F48D40017 for ; Fri, 19 Jul 2024 14:39:00 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf12.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721399910; a=rsa-sha256; cv=none; b=KjiYuQQAvX0vY2lT8QijSASLfqtUiVOuU46QG5HMQWa+I9rzPh5gQt8SumxRvHK1sOgf3J GhoXbyJRLRp2Y8Dtbl9dPtqX9JIFW/rGVTyTdsfQZOEfqtD3FjysHEDwBCXFJvTcoGFfQJ j+CRwxwULzeE+Z2c3i4H4PmBOYPKH7w= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf12.hostedemail.com: domain of jonathan.cameron@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=jonathan.cameron@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721399910; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sVkJ8iTMzQDTTDkcsRhAZk8qdYePuE5y5zKs/mscBik=; b=khK+cFn+qLZDsVGAH7NW8F+emEKHTHolQLEsxaCUAwX6dmuPjo2DDcGKPmjb2QzAS1VI+B sD3Kj8NtjWFaxkYUUQkXemi6UCzHXKPt3yy26J6KGo3/rBRhAaK9PJWZuace5SPs6QhomW R39mcJMlYJd/cu//Ot3I3ry45h+kd+I= Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WQXMF48rrz6JBjL; Fri, 19 Jul 2024 22:37:29 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id D6E9D140684; Fri, 19 Jul 2024 22:38:53 +0800 (CST) Received: from localhost (10.203.174.77) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 19 Jul 2024 15:38:53 +0100 Date: Fri, 19 Jul 2024 15:38:52 +0100 From: Jonathan Cameron To: David Hildenbrand CC: Mike Rapoport , , "Alexander Gordeev" , Andreas Larsson , Andrew Morton , Arnd Bergmann , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dan Williams , Dave Hansen , "David S. Miller" , Greg Kroah-Hartman , Heiko Carstens , "Huacai Chen" , Ingo Molnar , Jiaxun Yang , John Paul Adrian Glaubitz , Michael Ellerman , Palmer Dabbelt , "Rafael J. Wysocki" , Rob Herring , Thomas Bogendoerfer , Thomas Gleixner , "Vasily Gorbik" , Will Deacon , , , , , , , , , , , , , , , Subject: Re: [PATCH 02/17] MIPS: sgi-ip27: make NODE_DATA() the same as on all other architectures Message-ID: <20240719153852.00003f44@Huawei.com> In-Reply-To: References: <20240716111346.3676969-1-rppt@kernel.org> <20240716111346.3676969-3-rppt@kernel.org> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.203.174.77] X-ClientProxiedBy: lhrpeml500004.china.huawei.com (7.191.163.9) To lhrpeml500005.china.huawei.com (7.191.163.240) X-Rspamd-Queue-Id: 5F48D40017 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: emd4pyrsm8qkez993t9zxm3q9kjjm643 X-HE-Tag: 1721399940-619283 X-HE-Meta: U2FsdGVkX180EdPehz26pi6RZw4wSPdGsz5khdJR0BRsoPoxtZnHAnJzwK/zmYNpSlLVes4PktIjcqn2NU9i81hZT8OZiG3M+DjD3qASEl1oEQEJ5JOcMWW9Xx24ez+9iMUwJI0v6wTzKZCd0Ow+Dr314ssgfm2Xr4vBjqeC0PYZQtSdsJupxVxi5X9PfqvQ7mcFtMnh5N+XjwFZRgMh+MZavuuP521+HMiVFo8N8EPUqfjKG9xjufSZ6uQ9U8XNnU9NQ7rxrQcBFbDcJxtiTpeZ6clM3Bl0H8HuzWB75JeVKoRrLDPnV7j1wSW/Oca+zN+QGpybPsSEGt0r37tO5qCQAddCkTEaog9bQxch3f0LIOqrQ1gbdbUGeqVggKThXXzEBuxLfupsYkQOXUvtZCu8M59wMo09TZtak+qk248oadv1u0N7P5HbWUE7/jjeLM1lhxx64wKo1lwR3MHNcOsBsTZEVr/Xp4DEHf+o7M+N6P/wYJuyz+CtzgSlkE7Opd/+NuKWrznAqAX1udE2NG8mOsPJIqSJQ15ZTUGL2+2NzbxtLh3QbPCiv7t7GD8aQFrQbm6q4guxRVsnRRvCw1/92Bz/NeOPgCdWLctvShmFIkvnQBfX3/L5LnjOkY82390mAouDvXAifW+F18XmkwdrE0EvrfNB99HbLDQ/V4PvbDY/8lN4IkDdKyDi9xbUJ3p70+JNCOZXNeke54FhihVumFRjq3XVIMvIT/ptjK4TsQ54LtDDxCE1sbk175w+gcUl1LXFbo+iiOiMpJQLV/Oxx4HWELgb66fkCQRT/TrNfpAYbR4fXM5zR9Q6+LdLkFux9lJw+Yfw5Tofvq3TFnbW8jfjQel6ICf0BMcqYuEtMY9y6v8LIvIQHyf5U7zPISSQOU2QdbTCy57rlsttnorzOzyno/W9U4PKtjFBYMewLsjShoykVidU4m+QD39oh3gO4ZbOOHQbcSk294L msw5mT2h /tVeaOK4nEqvlYi7km5Pi4/9iQ4G1ZBHaATTQPSmMVvMdVekQVXaaL7hEcyG4WGGaEavlt+Nby2zsHjb0mE148YfvujIBo9itRD+luqI1gdwdb4bnUk/JhcLmN5zOHZq11CZYy0BVsgpjzJVZSp0/8sgbmwbAv5YY+P/a4ZMxfodTbBC1UYA2u960d3TeMPKnCMglS9xp8qc92jJXDX5H8UvYm3J2wji8k1G6XScUum2r57cJOZrewAO/0OrdlQ6kqooOZGyJRP4s9qh57GK3v2MMrB6X+WLYjzIiFwb3l+ezqx05Tp1Ae7JPgObeW5SP9ZG1+TEkhiYjJZKwqlyFU5ttFh4nhqnYVWWQ6O4xysHCYeAdHUTJD14Y8GffCZ6hHOUqNXfQxERInGI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, 17 Jul 2024 16:32:59 +0200 David Hildenbrand wrote: > On 16.07.24 13:13, Mike Rapoport wrote: > > From: "Mike Rapoport (Microsoft)" > > > > sgi-ip27 is the only system that defines NODE_DATA() differently than > > the rest of NUMA machines. > > > > Add node_data array of struct pglist pointers that will point to > > __node_data[node]->pglist and redefine NODE_DATA() to use node_data > > array. > > > > This will allow pulling declaration of node_data to the generic mm code > > in the next commit. > > > > Signed-off-by: Mike Rapoport (Microsoft) > > --- > > arch/mips/include/asm/mach-ip27/mmzone.h | 5 ++++- > > arch/mips/sgi-ip27/ip27-memory.c | 5 ++++- > > 2 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/arch/mips/include/asm/mach-ip27/mmzone.h b/arch/mips/include/asm/mach-ip27/mmzone.h > > index 08c36e50a860..629c3f290203 100644 > > --- a/arch/mips/include/asm/mach-ip27/mmzone.h > > +++ b/arch/mips/include/asm/mach-ip27/mmzone.h > > @@ -22,7 +22,10 @@ struct node_data { > > > > extern struct node_data *__node_data[]; > > > > -#define NODE_DATA(n) (&__node_data[(n)]->pglist) > > #define hub_data(n) (&__node_data[(n)]->hub) > > > > +extern struct pglist_data *node_data[]; > > + > > +#define NODE_DATA(nid) (node_data[nid]) > > + > > #endif /* _ASM_MACH_MMZONE_H */ > > diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c > > index b8ca94cfb4fe..c30ef6958b97 100644 > > --- a/arch/mips/sgi-ip27/ip27-memory.c > > +++ b/arch/mips/sgi-ip27/ip27-memory.c > > @@ -34,8 +34,10 @@ > > #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) > > #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) > > > > -struct node_data *__node_data[MAX_NUMNODES]; > > +struct pglist_data *node_data[MAX_NUMNODES]; > > +EXPORT_SYMBOL(node_data); > > > > +struct node_data *__node_data[MAX_NUMNODES]; > > EXPORT_SYMBOL(__node_data); > > > > static u64 gen_region_mask(void) > > @@ -361,6 +363,7 @@ static void __init node_mem_init(nasid_t node) > > */ > > __node_data[node] = __va(slot_freepfn << PAGE_SHIFT); > > memset(__node_data[node], 0, PAGE_SIZE); > > + node_data[node] = &__node_data[node]->pglist; > > > > NODE_DATA(node)->node_start_pfn = start_pfn; > > NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; > > I was assuming we could get rid of __node_data->pglist. > > But now I am confused where that is actually set. It looks nasty... Cast in arch_refresh_nodedata() takes incoming pg_data_t * and casts it to the local version of struct node_data * which I think is this one struct node_data { struct pglist_data pglist; (which is pg_data_t pglist) struct hub_data hub; }; https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L432 Now that pg_data_t is allocated by arch_alloc_nodedata() which might be fine (though types could be handled in a more readable fashion via some container_of() magic. https://elixir.bootlin.com/linux/v6.10/source/arch/mips/sgi-ip27/ip27-memory.c#L427 However that call is: pg_data_t * __init arch_alloc_nodedata(int nid) { return memblock_alloc(sizeof(pg_data_t), SMP_CACHE_BYTES); } So doesn't seem to allocate enough space to me as should be sizeof(struct node_data) Worth cleaning up whilst here? Proper handling of types would definitely help. Jonathan > > Anyhow > > Reviewed-by: David Hildenbrand >