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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 782ADC433E2 for ; Mon, 20 Jul 2020 02:02:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D1C320B1F for ; Mon, 20 Jul 2020 02:02:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727085AbgGTCC5 (ORCPT ); Sun, 19 Jul 2020 22:02:57 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51734 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726225AbgGTCC4 (ORCPT ); Sun, 19 Jul 2020 22:02:56 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C24A7AB957D3D94B7215; Mon, 20 Jul 2020 10:02:53 +0800 (CST) Received: from [127.0.0.1] (10.174.179.33) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Mon, 20 Jul 2020 10:02:43 +0800 Subject: Re: [PATCH v2 0/6] ACPI: Only create NUMA nodes from entries in SRAT or SRAT emulation. To: Jonathan Cameron , , , , CC: Lorenzo Pieralisi , Bjorn Helgaas , , , "Ingo Molnar" , , Tony Luck , Fenghua Yu , Thomas Gleixner , , Dan Williams , Song Bao Hua References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> From: Hanjun Guo Message-ID: <9b679614-083b-cec4-e0de-34e1a66b103a@huawei.com> Date: Mon, 20 Jul 2020 10:02:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.33] X-CFilter-Loop: Reflected Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On 2020/7/18 1:59, Jonathan Cameron wrote: > Here, I will use the term Proximity Domains for the ACPI description and > NUMA Nodes for the in kernel representation. > > ACPI 6.3 included a clarification that only Static Resource Allocation > Structures in SRAT may define the existence of proximity domains > (sec 5.2.16). This clarification closed a possible interpretation that > other parts of ACPI (e.g. DSDT _PXM, NFIT etc) could define new proximity > domains that were not also mentioned in SRAT structures. > > In practice the kernel has never allowed this alternative interpretation as > such nodes are only partially initialized. This is architecture specific > but to take an example, on x86 alloc_node_data has not been called. > Any use of them for node specific allocation, will result in a crash as the > infrastructure to fallback to a node with memory is not setup. > > We ran into a problem when enabling _PXM handling for PCI devices and found > there were boards out there advertising devices in proximity domains that > didn't exist [2]. > > The fix suggested in this series is to replace instances that should not > 'create' new nodes with pxm_to_node. This function needs a some additional > hardening against invalid inputs to make sure it is safe for use in these > new callers. > > Patch 1 Hardens pxm_to_node() against numa_off, and pxm entry being too large. > > Patch 2-4 change the various callers not related to SRAT entries so that they > set this parameter to false, so do not attempt to initialize a new NUMA node > if the relevant one does not already exist. > > Patch 5 is a function rename to reflect change in functionality of > acpi_map_pxm_to_online_node() as it no longer creates a new map, but just does a > lookup of existing maps. > > Patch 6 covers the one place we do not allow the full flexibility defined > in the ACPI spec. For SRAT GIC Interrupt Translation Service (ITS) Affinity > Structures, on ARM64, the driver currently makes an additional pass of SRAT > later in the boot than the one used to identify NUMA domains. > Note, this currently means that an ITS placed in a proximity domain that is > not defined by another SRAT structure will result in the a crash. > > To avoid this crash with minimal changes we do not create new NUMA nodes based > on this particular entry type. Any current platform trying to do this will not > boot, so this is an improvement, if perhaps not a perfect solution. Make sense to me, Reviewed-by: Hanjun Guo 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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B196FC433E2 for ; Mon, 20 Jul 2020 02:04:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E2A620B1F for ; Mon, 20 Jul 2020 02:04:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="BuaxA51E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E2A620B1F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kqwhEqkAATRDXSRefTux5ZmvB0XezKdM24ofQmWEsbg=; b=BuaxA51EYIOcvc4FiX5nwDJyR 4ty9+lJAM41YKoh8N8K/Yhv7ihtnU9R0Sn2GhUvoq3WagegquhHBhmGP81GKhd3GDSqlBZnqdcEqF decQo8zr57zBs5Z5MxtpWl6FcIsYD33guMn3Zzj1b6PCEAHxXWI2i5ZSSild6Ocf8NYeMUqRtwYWa jb3zV1V9jx8d6d93ZADnBj3Pwdd7Zt7aTRkCTsAMc27EG7IshS7uWUYCZXWhTVQHGly3wLuA2KQ2E l/ALLx4xQn1JJOKLAq5KiWChh9kENs3URQwmr+3OkurfnkrrOdAaT1njbdvqfs4RyuRpulrHFsjUg Iv52KLXoA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxL8v-00034A-48; Mon, 20 Jul 2020 02:03:01 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxL8s-000321-Vj for linux-arm-kernel@lists.infradead.org; Mon, 20 Jul 2020 02:02:59 +0000 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id C24A7AB957D3D94B7215; Mon, 20 Jul 2020 10:02:53 +0800 (CST) Received: from [127.0.0.1] (10.174.179.33) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Mon, 20 Jul 2020 10:02:43 +0800 Subject: Re: [PATCH v2 0/6] ACPI: Only create NUMA nodes from entries in SRAT or SRAT emulation. To: Jonathan Cameron , , , , References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> From: Hanjun Guo Message-ID: <9b679614-083b-cec4-e0de-34e1a66b103a@huawei.com> Date: Mon, 20 Jul 2020 10:02:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> Content-Language: en-GB X-Originating-IP: [10.174.179.33] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200719_220259_270539_D0291221 X-CRM114-Status: GOOD ( 20.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Song Bao Hua , Fenghua Yu , Lorenzo Pieralisi , linux-ia64@vger.kernel.org, Tony Luck , linux-pci@vger.kernel.org, linuxarm@huawei.com, Ingo Molnar , martin@geanix.com, Bjorn Helgaas , Thomas Gleixner , Dan Williams Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020/7/18 1:59, Jonathan Cameron wrote: > Here, I will use the term Proximity Domains for the ACPI description and > NUMA Nodes for the in kernel representation. > > ACPI 6.3 included a clarification that only Static Resource Allocation > Structures in SRAT may define the existence of proximity domains > (sec 5.2.16). This clarification closed a possible interpretation that > other parts of ACPI (e.g. DSDT _PXM, NFIT etc) could define new proximity > domains that were not also mentioned in SRAT structures. > > In practice the kernel has never allowed this alternative interpretation as > such nodes are only partially initialized. This is architecture specific > but to take an example, on x86 alloc_node_data has not been called. > Any use of them for node specific allocation, will result in a crash as the > infrastructure to fallback to a node with memory is not setup. > > We ran into a problem when enabling _PXM handling for PCI devices and found > there were boards out there advertising devices in proximity domains that > didn't exist [2]. > > The fix suggested in this series is to replace instances that should not > 'create' new nodes with pxm_to_node. This function needs a some additional > hardening against invalid inputs to make sure it is safe for use in these > new callers. > > Patch 1 Hardens pxm_to_node() against numa_off, and pxm entry being too large. > > Patch 2-4 change the various callers not related to SRAT entries so that they > set this parameter to false, so do not attempt to initialize a new NUMA node > if the relevant one does not already exist. > > Patch 5 is a function rename to reflect change in functionality of > acpi_map_pxm_to_online_node() as it no longer creates a new map, but just does a > lookup of existing maps. > > Patch 6 covers the one place we do not allow the full flexibility defined > in the ACPI spec. For SRAT GIC Interrupt Translation Service (ITS) Affinity > Structures, on ARM64, the driver currently makes an additional pass of SRAT > later in the boot than the one used to identify NUMA domains. > Note, this currently means that an ITS placed in a proximity domain that is > not defined by another SRAT structure will result in the a crash. > > To avoid this crash with minimal changes we do not create new NUMA nodes based > on this particular entry type. Any current platform trying to do this will not > boot, so this is an improvement, if perhaps not a perfect solution. Make sense to me, Reviewed-by: Hanjun Guo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hanjun Guo Date: Mon, 20 Jul 2020 02:02:42 +0000 Subject: Re: [PATCH v2 0/6] ACPI: Only create NUMA nodes from entries in SRAT or SRAT emulation. Message-Id: <9b679614-083b-cec4-e0de-34e1a66b103a@huawei.com> List-Id: References: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> In-Reply-To: <20200717175959.899775-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jonathan Cameron , linux-mm@kvack.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: Lorenzo Pieralisi , Bjorn Helgaas , linux-pci@vger.kernel.org, martin@geanix.com, Ingo Molnar , linux-ia64@vger.kernel.org, Tony Luck , Fenghua Yu , Thomas Gleixner , linuxarm@huawei.com, Dan Williams , Song Bao Hua On 2020/7/18 1:59, Jonathan Cameron wrote: > Here, I will use the term Proximity Domains for the ACPI description and > NUMA Nodes for the in kernel representation. > > ACPI 6.3 included a clarification that only Static Resource Allocation > Structures in SRAT may define the existence of proximity domains > (sec 5.2.16). This clarification closed a possible interpretation that > other parts of ACPI (e.g. DSDT _PXM, NFIT etc) could define new proximity > domains that were not also mentioned in SRAT structures. > > In practice the kernel has never allowed this alternative interpretation as > such nodes are only partially initialized. This is architecture specific > but to take an example, on x86 alloc_node_data has not been called. > Any use of them for node specific allocation, will result in a crash as the > infrastructure to fallback to a node with memory is not setup. > > We ran into a problem when enabling _PXM handling for PCI devices and found > there were boards out there advertising devices in proximity domains that > didn't exist [2]. > > The fix suggested in this series is to replace instances that should not > 'create' new nodes with pxm_to_node. This function needs a some additional > hardening against invalid inputs to make sure it is safe for use in these > new callers. > > Patch 1 Hardens pxm_to_node() against numa_off, and pxm entry being too large. > > Patch 2-4 change the various callers not related to SRAT entries so that they > set this parameter to false, so do not attempt to initialize a new NUMA node > if the relevant one does not already exist. > > Patch 5 is a function rename to reflect change in functionality of > acpi_map_pxm_to_online_node() as it no longer creates a new map, but just does a > lookup of existing maps. > > Patch 6 covers the one place we do not allow the full flexibility defined > in the ACPI spec. For SRAT GIC Interrupt Translation Service (ITS) Affinity > Structures, on ARM64, the driver currently makes an additional pass of SRAT > later in the boot than the one used to identify NUMA domains. > Note, this currently means that an ITS placed in a proximity domain that is > not defined by another SRAT structure will result in the a crash. > > To avoid this crash with minimal changes we do not create new NUMA nodes based > on this particular entry type. Any current platform trying to do this will not > boot, so this is an improvement, if perhaps not a perfect solution. Make sense to me, Reviewed-by: Hanjun Guo