Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757154AbcJXEnA (ORCPT ); Mon, 24 Oct 2016 00:43:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60028 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757087AbcJXEmy (ORCPT ); Mon, 24 Oct 2016 00:42:54 -0400 From: Anshuman Khandual To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: mhocko@suse.com, js1304@gmail.com, vbabka@suse.cz, mgorman@suse.de, minchan@kernel.org, akpm@linux-foundation.org, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com Subject: [DEBUG 05/10] powerpc/mm: Identify isolation seeking coherent memory nodes during boot Date: Mon, 24 Oct 2016 10:12:24 +0530 X-Mailer: git-send-email 2.1.0 In-Reply-To: <1477284149-2976-1-git-send-email-khandual@linux.vnet.ibm.com> References: <1477283517-2504-1-git-send-email-khandual@linux.vnet.ibm.com> <1477284149-2976-1-git-send-email-khandual@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16102404-0012-0000-0000-000001DA3F2B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16102404-0013-0000-0000-000006440F1F Message-Id: <1477284149-2976-6-git-send-email-khandual@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-23_18:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610240083 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2054 Lines: 65 Isolation seeking coherent memory nodes which wish to be MNODE_ISOLATION in core VM will have "ibm,hotplug-aperture" as one of the compatible properties in their respective device nodes in device tree. Detect them during platform NUMA initialization and mark their respective coherent mask in pglist_data structure as MNODE_ISOLATION. Signed-off-by: Anshuman Khandual --- arch/powerpc/mm/numa.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index 5010181..89ae64c 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -64,6 +64,7 @@ static int form1_affinity; static int distance_ref_points_depth; static const __be32 *distance_ref_points; static int distance_lookup_table[MAX_NUMNODES][MAX_DISTANCE_REF_POINTS]; +static int node_to_phys_device_map[MAX_NUMNODES]; /* * Allocate node_to_cpumask_map based on number of available nodes @@ -714,6 +715,17 @@ static const struct of_device_id memory_match[] = { { /* sentinel */ } }; +int arch_get_memory_phys_device(unsigned long start_pfn) +{ + return node_to_phys_device_map[pfn_to_nid(start_pfn)]; +} + +int special_mem_node(int nid) +{ + return node_to_phys_device_map[nid]; +} +EXPORT_SYMBOL(special_mem_node); + static int __init parse_numa_properties(void) { struct device_node *memory; @@ -789,6 +801,9 @@ static int __init parse_numa_properties(void) if (nid < 0) nid = default_nid; + if (of_device_is_compatible(memory, "ibm,hotplug-aperture")) + node_to_phys_device_map[nid] = 1; + fake_numa_create_new_node(((start + size) >> PAGE_SHIFT), &nid); node_set_online(nid); @@ -908,6 +923,11 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn) NODE_DATA(nid)->node_id = nid; NODE_DATA(nid)->node_start_pfn = start_pfn; NODE_DATA(nid)->node_spanned_pages = spanned_pages; + +#ifdef CONFIG_COHERENT_DEVICE + if (special_mem_node(nid)) + set_cdm_isolation(nid); +#endif } void __init initmem_init(void) -- 2.1.0