[{"id":1778897,"web_url":"http://patchwork.ozlabs.org/comment/1778897/","msgid":"<20171003122823.mdzkhxs4xza7sb2w@dhcp22.suse.cz>","list_archive_url":null,"date":"2017-10-03T12:28:23","subject":"Re: [PATCH v9 02/12] sparc64/mm: setting fields in deferred pages","submitter":{"id":66979,"url":"http://patchwork.ozlabs.org/api/people/66979/","name":"Michal Hocko","email":"mhocko@kernel.org"},"content":"On Wed 20-09-17 16:17:04, Pavel Tatashin wrote:\n> Without deferred struct page feature (CONFIG_DEFERRED_STRUCT_PAGE_INIT),\n> flags and other fields in \"struct page\"es are never changed prior to first\n> initializing struct pages by going through __init_single_page().\n> \n> With deferred struct page feature enabled there is a case where we set some\n> fields prior to initializing:\n> \n> mem_init() {\n>      register_page_bootmem_info();\n>      free_all_bootmem();\n>      ...\n> }\n> \n> When register_page_bootmem_info() is called only non-deferred struct pages\n> are initialized. But, this function goes through some reserved pages which\n> might be part of the deferred, and thus are not yet initialized.\n> \n> mem_init\n> register_page_bootmem_info\n> register_page_bootmem_info_node\n>  get_page_bootmem\n>   .. setting fields here ..\n>   such as: page->freelist = (void *)type;\n> \n> free_all_bootmem()\n> free_low_memory_core_early()\n>  for_each_reserved_mem_region()\n>   reserve_bootmem_region()\n>    init_reserved_page() <- Only if this is deferred reserved page\n>     __init_single_pfn()\n>      __init_single_page()\n>       memset(0) <-- Loose the set fields here\n> \n> We end-up with similar issue as in the previous patch, where currently we\n> do not observe problem as memory is zeroed. But, if flag asserts are\n> changed we can start hitting issues.\n> \n> Also, because in this patch series we will stop zeroing struct page memory\n> during allocation, we must make sure that struct pages are properly\n> initialized prior to using them.\n> \n> The deferred-reserved pages are initialized in free_all_bootmem().\n> Therefore, the fix is to switch the above calls.\n> \n> Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>\n> Reviewed-by: Steven Sistare <steven.sistare@oracle.com>\n> Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>\n> Reviewed-by: Bob Picco <bob.picco@oracle.com>\n> Acked-by: David S. Miller <davem@davemloft.net>\n\nAs you separated x86 and sparc patches doing essentially the same I\nassume David is going to take this patch?\n\nAcked-by: Michal Hocko <mhocko@suse.com>\n\n> ---\n>  arch/sparc/mm/init_64.c | 8 +++++++-\n>  1 file changed, 7 insertions(+), 1 deletion(-)\n> \n> diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c\n> index 6034569e2c0d..310c6754bcaa 100644\n> --- a/arch/sparc/mm/init_64.c\n> +++ b/arch/sparc/mm/init_64.c\n> @@ -2548,9 +2548,15 @@ void __init mem_init(void)\n>  {\n>  \thigh_memory = __va(last_valid_pfn << PAGE_SHIFT);\n>  \n> -\tregister_page_bootmem_info();\n>  \tfree_all_bootmem();\n>  \n> +\t/* Must be done after boot memory is put on freelist, because here we\n> +\t * might set fields in deferred struct pages that have not yet been\n> +\t * initialized, and free_all_bootmem() initializes all the reserved\n> +\t * deferred pages for us.\n> +\t */\n> +\tregister_page_bootmem_info();\n> +\n>  \t/*\n>  \t * Set up the zero page, mark it reserved, so that page count\n>  \t * is not manipulated when freeing the page from user ptes.\n> -- \n> 2.14.1","headers":{"Return-Path":"<sparclinux-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=sparclinux-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y5yxm3xP7z9ryk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue,  3 Oct 2017 23:28:44 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753525AbdJCM21 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 3 Oct 2017 08:28:27 -0400","from mx2.suse.de ([195.135.220.15]:42279 \"EHLO mx1.suse.de\"\n\trhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP\n\tid S1753621AbdJCM20 (ORCPT <rfc822;sparclinux@vger.kernel.org>);\n\tTue, 3 Oct 2017 08:28:26 -0400","from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx1.suse.de (Postfix) with ESMTP id 6BBD5AC68;\n\tTue,  3 Oct 2017 12:28:24 +0000 (UTC)"],"X-Virus-Scanned":"by amavisd-new at test-mx.suse.de","Date":"Tue, 3 Oct 2017 14:28:23 +0200","From":"Michal Hocko <mhocko@kernel.org>","To":"Pavel Tatashin <pasha.tatashin@oracle.com>","Cc":"linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,\n\tlinux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,\n\tlinux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tx86@kernel.org, kasan-dev@googlegroups.com, borntraeger@de.ibm.com,\n\theiko.carstens@de.ibm.com, davem@davemloft.net,\n\twilly@infradead.org, ard.biesheuvel@linaro.org,\n\tmark.rutland@arm.com, will.deacon@arm.com, catalin.marinas@arm.com,\n\tsam@ravnborg.org, mgorman@techsingularity.net,\n\tsteven.sistare@oracle.com, daniel.m.jordan@oracle.com,\n\tbob.picco@oracle.com","Subject":"Re: [PATCH v9 02/12] sparc64/mm: setting fields in deferred pages","Message-ID":"<20171003122823.mdzkhxs4xza7sb2w@dhcp22.suse.cz>","References":"<20170920201714.19817-1-pasha.tatashin@oracle.com>\n\t<20170920201714.19817-3-pasha.tatashin@oracle.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170920201714.19817-3-pasha.tatashin@oracle.com>","User-Agent":"NeoMutt/20170609 (1.8.3)","Sender":"sparclinux-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<sparclinux.vger.kernel.org>","X-Mailing-List":"sparclinux@vger.kernel.org"}},{"id":1779062,"web_url":"http://patchwork.ozlabs.org/comment/1779062/","msgid":"<3c410186-0af9-dae8-84eb-8f4d4651d355@oracle.com>","list_archive_url":null,"date":"2017-10-03T15:10:35","subject":"Re: [PATCH v9 02/12] sparc64/mm: setting fields in deferred pages","submitter":{"id":71010,"url":"http://patchwork.ozlabs.org/api/people/71010/","name":"Pavel Tatashin","email":"pasha.tatashin@oracle.com"},"content":"> \n> As you separated x86 and sparc patches doing essentially the same I\n> assume David is going to take this patch?\n\nCorrect, I noticed that usually platform specific changes are done in \nseparate patches even if they are small. Dave already Acked this patch. \nSo, I do not think it should be separated from the rest of the patches \nwhen this projects goes into mm-tree.\n\n> \n> Acked-by: Michal Hocko <mhocko@suse.com>\n\nThank you,\nPasha\n\n--\nTo unsubscribe from this list: send the line \"unsubscribe sparclinux\" in\nthe body of a message to majordomo@vger.kernel.org\nMore majordomo info at  http://vger.kernel.org/majordomo-info.html","headers":{"Return-Path":"<sparclinux-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=sparclinux-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y62Z4271zz9sPk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  4 Oct 2017 02:11:56 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751966AbdJCPLz (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 3 Oct 2017 11:11:55 -0400","from aserp1040.oracle.com ([141.146.126.69]:27068 \"EHLO\n\taserp1040.oracle.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751527AbdJCPLy (ORCPT\n\t<rfc822; sparclinux@vger.kernel.org>); Tue, 3 Oct 2017 11:11:54 -0400","from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74])\n\tby aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with\n\tESMTP id v93FAdub016143\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Tue, 3 Oct 2017 15:10:39 GMT","from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])\n\tby userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id\n\tv93FAc6g003030\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256\n\tverify=OK); Tue, 3 Oct 2017 15:10:38 GMT","from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13])\n\tby aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id\n\tv93FAbhq026640; Tue, 3 Oct 2017 15:10:37 GMT","from [192.168.1.10] (/98.216.35.41)\n\tby default (Oracle Beehive Gateway v4.0)\n\twith ESMTP ; Tue, 03 Oct 2017 08:10:37 -0700"],"Subject":"Re: [PATCH v9 02/12] sparc64/mm: setting fields in deferred pages","To":"Michal Hocko <mhocko@kernel.org>","Cc":"linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org,\n\tlinux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,\n\tlinux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tx86@kernel.org, kasan-dev@googlegroups.com, borntraeger@de.ibm.com,\n\theiko.carstens@de.ibm.com, davem@davemloft.net,\n\twilly@infradead.org, ard.biesheuvel@linaro.org,\n\tmark.rutland@arm.com, will.deacon@arm.com, catalin.marinas@arm.com,\n\tsam@ravnborg.org, mgorman@techsingularity.net,\n\tsteven.sistare@oracle.com, daniel.m.jordan@oracle.com,\n\tbob.picco@oracle.com","References":"<20170920201714.19817-1-pasha.tatashin@oracle.com>\n\t<20170920201714.19817-3-pasha.tatashin@oracle.com>\n\t<20171003122823.mdzkhxs4xza7sb2w@dhcp22.suse.cz>","From":"Pasha Tatashin <pasha.tatashin@oracle.com>","Message-ID":"<3c410186-0af9-dae8-84eb-8f4d4651d355@oracle.com>","Date":"Tue, 3 Oct 2017 11:10:35 -0400","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20171003122823.mdzkhxs4xza7sb2w@dhcp22.suse.cz>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Language":"en-US","Content-Transfer-Encoding":"7bit","X-Source-IP":"userv0022.oracle.com [156.151.31.74]","Sender":"sparclinux-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<sparclinux.vger.kernel.org>","X-Mailing-List":"sparclinux@vger.kernel.org"}}]