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 4FE03C46CD2 for ; Tue, 9 Jan 2024 15:53:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBAFD6B0095; Tue, 9 Jan 2024 10:53:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D6AEA6B0096; Tue, 9 Jan 2024 10:53:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C59F86B0098; Tue, 9 Jan 2024 10:53:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B5EC66B0095 for ; Tue, 9 Jan 2024 10:53:09 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 770E080924 for ; Tue, 9 Jan 2024 15:53:09 +0000 (UTC) X-FDA: 81660216498.26.10D7B60 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf27.hostedemail.com (Postfix) with ESMTP id 5B19B4000A for ; Tue, 9 Jan 2024 15:53:07 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of artem.kuzin@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=artem.kuzin@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704815587; 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=nZ0nJjR6L9Xrvn8u25jNahvh+69fVSv5GQDm+EOOSkE=; b=QHVLKygj4ZW+4luAX5gI88kaAcxWY1teUOoPD4rU4rV0vh0DPOnEC1i17QmVS8tgC0BTVl U2CWSMlALFEgyRGh6JDHmUskKd7WcPslo7MWJQdp/QXuzkTGGfIbGtHZfGnDXw8uKI9+nn j6Lliv0MXMtJjUXIxJt4Onu0875MLB4= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of artem.kuzin@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=artem.kuzin@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704815587; a=rsa-sha256; cv=none; b=kMPOB0CIEsGR+Miia3cgUFnH5E+VV2Gl8ipei5Bywu2o6g4Zsa/5UjJBNalyN+PpXsm0Pn H8kioplngvUqqtAyl4pIS8fF1FK29uzBnpyXfUU7yaiw6LnCR60CiQSN77v1cYF84PSLiR MNAcuyofsxSJXt7xIFamCJ+SM42THGU= Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4T8b510y91z6J6Fc; Tue, 9 Jan 2024 23:51:17 +0800 (CST) Received: from lhrpeml500001.china.huawei.com (unknown [7.191.163.213]) by mail.maildlp.com (Postfix) with ESMTPS id CA1D1140A08; Tue, 9 Jan 2024 23:53:03 +0800 (CST) Received: from [10.123.123.147] (10.123.123.147) by lhrpeml500001.china.huawei.com (7.191.163.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 9 Jan 2024 15:53:01 +0000 Message-ID: Date: Tue, 9 Jan 2024 18:53:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: "a00561249@china.huawei.com" Subject: Re: [PATCH RFC 04/12] x86: add support of memory protection for NUMA replicas To: "Garg, Shivank" , , , , , , , , , , , , , , CC: , , , , , , , , , , , , References: <20231228131056.602411-1-artem.kuzin@huawei.com> <20231228131056.602411-5-artem.kuzin@huawei.com> <083a2549-f4ed-478e-a4ff-938a3eb15ab0@amd.com> Content-Language: en-US In-Reply-To: <083a2549-f4ed-478e-a4ff-938a3eb15ab0@amd.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.123.123.147] X-ClientProxiedBy: mscpeml500003.china.huawei.com (7.188.49.51) To lhrpeml500001.china.huawei.com (7.191.163.213) X-Rspam-User: X-Stat-Signature: nhrzrn4c3t6edkfwqbxkq4xwfachyizb X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 5B19B4000A X-HE-Tag: 1704815587-407631 X-HE-Meta: U2FsdGVkX1//dY47F8qzD+F3RBRJaLEh7fUf6YZJEJ8NjKWvwGMdUwQdro7U/rD0SXR5bivJnt4EnV4IQVqOuBPRO0QVALAfBw7MoLsTxm12BEkpejq8kMTe0zbF1Sh9rkZaz17Udu/ifRIx07X61s0Z8hnLXOF3+gF81W/8QNkxL4frSJUXrR60LySv/UaBk8faC60JabtOw0T9kpcC9I49zRtJIDn2XUVTxP+lvGbxWCqsXDm0oIhiFazZQRgxYdy5nB0kMd0Yt5qSILKMAc94DzrNyM9o2DcElEalFE4k4xeOGjeUJjiLCaUzmyMeWZdEHjf24BVYD8keeXuBDaZKzlLZ8etJdu2HnkkQlWVtmafjG6A+guHhKVsfutHgV6u1au7QvQlci72cgQEipCXzxcEu7EG2dLuUKlJ9gHW9xTRf/Lw1g3ynDgWmpUE4af/0zMp6wlbFKQYcCMFCI1qMEsHOxfRlI/Q4XA/+h+MvuNnj3PuTBeq+S6XGqUwSig4yP7Hx6xhwhCRGI6+K35VAN445jJByfpQitQb7sbzdh+Bjr2F3eoNNiL9u7BjFvbOA+a51WsDpvceFc3rs7PGyXtGEvo8MdVbU+oSrVO5rdndAckBb1JscnFbw301+4Ct5fWCQFyADJKhIJcftPRlL3Tf2p8gysoeIqFpcBAhHePOBPl3ACA9faJ24ibI/6mUUAhWKjos+mRu4ev7VGERx7bxEf5/RHetjfs5ZYhq4/3EAgnl6p7siw6l41dcr47GbTkJYjxKciarY2L02ridrGvtBZjSnXOD19HOBys3wYpD79Ekc5Iy5OWM6B7CfW84jDFIG6fDxcZ5pwNCkJ9yaScvsG+mtdlbKXSL61wnTglD/XH6gTUEcE60JSUcg76agZengiSwTDYfVS9/htCtHUdxeOkA9BqD5kBahYu8GP1V9Vh3bR1IlF+5DHYLH40xfS6UTbfihzYkjtpA rGgrt6cU g7zFIwrBhtVI0wFhsmBETG4jP/oPLHK3w/5jmcVI6Sstvhh2j8P1hvQurol5t8bNpsn1/ez+C8i9gaqGArNA0v3mOvcBZEKhCh/4wXM+PdF/heL4yNUy3zfgSXLdP57iEzd48p4bcCTKO90hcZjPckbhQ7da3A4A3SpUOpMpNFregzFnyQ+R+5yjUULVsE8se3Hc9hOQp4fztHMpKPuA2NJkGzt93w4JwbRjtV5KL2eEDc0HLMlE1oJ4z2GERbCFJ2j0r+SN3mQMhXmF3SMkXvP3DSp3iLuBVhsum6H45mepqdMzKpTXMeFF1yAV57tMQSUFV1Yf5CM11CMhmQutwe5Tha5s0l0gPpxC9K0MdvD6jtOGP/cdk7FbmQ5zOWRzD48TCM0PQFdW7f/41+83sS+LcCMGxGV7fp8wUAfUUJ+zgo+qfVkwZzd+RgGBs6Oumt8ZeRQPuZvknPAQSWh6KommFjA== 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: Hi Shivank, thanks a lot for the comments and findings, I've fixed build and plan to update the patch set soon. On 1/9/2024 9:46 AM, Garg, Shivank wrote: > Hi Artem, > > I hope this message finds you well. > I've encountered a compilation issue when KERNEL_REPLICATION is disabled in the config. > > ld: vmlinux.o: in function `alloc_insn_page': > /home/amd/linux_mainline/arch/x86/kernel/kprobes/core.c:425: undefined reference to `numa_set_memory_rox' > ld: vmlinux.o: in function `alloc_new_pack': > /home/amd/linux_mainline/kernel/bpf/core.c:873: undefined reference to `numa_set_memory_rox' > ld: vmlinux.o: in function `bpf_prog_pack_alloc': > /home/amd/linux_mainline/kernel/bpf/core.c:891: undefined reference to `numa_set_memory_rox' > ld: vmlinux.o: in function `bpf_trampoline_update': > /home/amd/linux_mainline/kernel/bpf/trampoline.c:447: undefined reference to `numa_set_memory_rox' > ld: vmlinux.o: in function `bpf_struct_ops_map_update_elem': > /home/amd/linux_mainline/kernel/bpf/bpf_struct_ops.c:515: undefined reference to `numa_set_memory_rox' > ld: vmlinux.o:/home/amd/linux_mainline/kernel/bpf/bpf_struct_ops.c:524: more undefined references to `numa_set_memory_rox' follow > > > After some investigation, I've put together a patch that resolves this compilation issues for me. > > --- a/arch/x86/mm/pat/set_memory.c > +++ b/arch/x86/mm/pat/set_memory.c > @@ -2268,6 +2268,15 @@ int numa_set_memory_nonglobal(unsigned long addr, int numpages) > > return ret; > } > + > +#else > + > +int numa_set_memory_rox(unsigned long addr, int numpages) > +{ > + return set_memory_rox(addr, numpages); > + > +} > + > #endif > > Additionally, I'm interested in evaluating the performance impact of this patchset on AMD processors. > Could you please point me the benchmarks that you have used in cover letter? > > Best Regards, > Shivank > Regarding the benchmarks, we used self-implemented test with system calls load for now. We used RedHawk Linux approach as a reference. The "An Overview of Kernel Text Page Replication in RedHawk™ Linux® 6.3" article was used. https://concurrent-rt.com/wp-content/uploads/2020/12/kernel-page-replication.pdf The test is very simple: All measured system calls have been invoked using syscall wrapper from glibc, e.g. #include       /* Definition of SYS_* constants */ #include   long syscall(long number, ...); fork/1     Time measurements include only one time of invoking this system call. Measurements are made between entering and exiting the system call. fork/1024     The system call is invoked in  a loop 1024 times. The time between entering a loop and exiting it was measured. mmap/munmap     A set of 1024 pages (if PAGE_SIZE is not defined it is equal to 4096) was mapped using mmap syscall and unmapped using munmap one. Every page is mapped/unmapped per a loop iteration. mmap/lock     The same as above, but in this case flag MAP_LOCKED was added. open/close     The /dev/null pseudo-file was opened and closed in a loop 1024 times. It was opened and closed once per iteration. mount     The pseudo-filesystem procFS was mounted to a temporary directory inside /tmp only one time. The time between entering and exiting the system call was measured. kill     A signal handler for SIGUSR1 was setup. Signal was sent to a child process, which was created using fork glibc's wrapper. Time between sending and receiving SIGUSR1 signal was measured. Testing environment: Processor Intel(R) Xeon(R) CPU E5-2690 2 nodes with 12 CPU cores for each one. Best Regards, Artem