Received: by 10.223.185.116 with SMTP id b49csp4178040wrg; Mon, 26 Feb 2018 12:37:48 -0800 (PST) X-Google-Smtp-Source: AH8x225oiPC25pvwmFulWjuWZjC0c4ZfXFulGEa2qeM/Z0JI8Qy4/h6H/XU1rNoBXWu/Lsa79j/V X-Received: by 10.98.13.196 with SMTP id 65mr11749885pfn.139.1519677468583; Mon, 26 Feb 2018 12:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519677468; cv=none; d=google.com; s=arc-20160816; b=VFG91i27QDvYxf9IgXC4StFznbvIy+jUeENFZzM/+JqHwc0baXHxNhH1rysW3mfn4M JRYWfPIeDPVguypHesQmipfYTxlNO4NPy87PA7o4uVg9rJCrz5cNtxzYyByqMBCyDYYF tLe8s3WDuMA86AzYY8eJwQM+VX7lyP9HrMREukcAzXdAQl5Ncw8MaFx2upitOSGRTuS6 fSWH4n3UzLDvN6eWlYSTXjdl9vu1SiuaXCb1p+8sw01lm3oTHbyjFlSiybubjxNcBv3f /guzTt6+BpsNr/qtWzdBs4msYX2RvnTDATC7Mj4WflfnsXbsbieD22CRnkg1DYTZDD5Q 9jqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FKMRgmnkiGxmpYcx3dr8Y3CQXT/wBNe54aOIDu1jIIE=; b=aWinxUdvcYPZqX8xyg2Icuq/rB7wm2k24eCTOo30Vmo0umC+99AyIp7ru9TNNlkFNO Z3t/qyhIt2VLPi1/+dsfhzD2MNBAsR6aKQbeAj59SA7wwnAbtgtESKQODceWXHoPuLpA SEFfVxAaHUeNssaT8Pn9u6MiPbUQkgo97gKBygdESjFKYqiQhIkhBmEXWJxfX2EjRO1W 6NC+FJ7ONnc6gtSorVEcwyMv0/x34ClphafL2AVtRyLwpFrdXRTTyfDodTz5OSKoyGqT urIcHUFUG18Nkpt7cPZxRKVpEjyKLmky2Q74iZ/DM/hpe+t1Mc8S2uHf4rCSMZ9rFFtD cPMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10-v6si7472743plk.706.2018.02.26.12.37.32; Mon, 26 Feb 2018 12:37:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753635AbeBZUgS (ORCPT + 99 others); Mon, 26 Feb 2018 15:36:18 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36678 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753739AbeBZU1i (ORCPT ); Mon, 26 Feb 2018 15:27:38 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C53D1E93; Mon, 26 Feb 2018 20:27:36 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juergen Gross , Pavel Tatashin , Steven Sistare , Daniel Jordan , Bob Picco , Andrew Morton , Linus Torvalds Subject: [PATCH 4.15 30/64] mm: dont defer struct page initialization for Xen pv guests Date: Mon, 26 Feb 2018 21:22:07 +0100 Message-Id: <20180226202154.736497772@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180226202153.453363333@linuxfoundation.org> References: <20180226202153.453363333@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Juergen Gross commit 895f7b8e90200cf1a5dc313329369adf30e51f9a upstream. Commit f7f99100d8d9 ("mm: stop zeroing memory during allocation in vmemmap") broke Xen pv domains in some configurations, as the "Pinned" information in struct page of early page tables could get lost. This will lead to the kernel trying to write directly into the page tables instead of asking the hypervisor to do so. The result is a crash like the following: BUG: unable to handle kernel paging request at ffff8801ead19008 IP: xen_set_pud+0x4e/0xd0 PGD 1c0a067 P4D 1c0a067 PUD 23a0067 PMD 1e9de0067 PTE 80100001ead19065 Oops: 0003 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.0-default+ #271 Hardware name: Dell Inc. Latitude E6440/0159N7, BIOS A07 06/26/2014 task: ffffffff81c10480 task.stack: ffffffff81c00000 RIP: e030:xen_set_pud+0x4e/0xd0 Call Trace: __pmd_alloc+0x128/0x140 ioremap_page_range+0x3f4/0x410 __ioremap_caller+0x1c3/0x2e0 acpi_os_map_iomem+0x175/0x1b0 acpi_tb_acquire_table+0x39/0x66 acpi_tb_validate_table+0x44/0x7c acpi_tb_verify_temp_table+0x45/0x304 acpi_reallocate_root_table+0x12d/0x141 acpi_early_init+0x4d/0x10a start_kernel+0x3eb/0x4a1 xen_start_kernel+0x528/0x532 Code: 48 01 e8 48 0f 42 15 a2 fd be 00 48 01 d0 48 ba 00 00 00 00 00 ea ff ff 48 c1 e8 0c 48 c1 e0 06 48 01 d0 48 8b 00 f6 c4 02 75 5d <4c> 89 65 00 5b 5d 41 5c c3 65 8b 05 52 9f fe 7e 89 c0 48 0f a3 RIP: xen_set_pud+0x4e/0xd0 RSP: ffffffff81c03cd8 CR2: ffff8801ead19008 ---[ end trace 38eca2e56f1b642e ]--- Avoid this problem by not deferring struct page initialization when running as Xen pv guest. Pavel said: : This is unique for Xen, so this particular issue won't effect other : configurations. I am going to investigate if there is a way to : re-enable deferred page initialization on xen guests. [akpm@linux-foundation.org: explicitly include xen.h] Link: http://lkml.kernel.org/r/20180216154101.22865-1-jgross@suse.com Fixes: f7f99100d8d95d ("mm: stop zeroing memory during allocation in vmemmap") Signed-off-by: Juergen Gross Reviewed-by: Pavel Tatashin Cc: Steven Sistare Cc: Daniel Jordan Cc: Bob Picco Cc: [4.15.x] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -347,6 +348,9 @@ static inline bool update_defer_init(pg_ /* Always populate low zones for address-contrained allocations */ if (zone_end < pgdat_end_pfn(pgdat)) return true; + /* Xen PV domains need page structures early */ + if (xen_pv_domain()) + return true; (*nr_initialised)++; if ((*nr_initialised > pgdat->static_init_pgcnt) && (pfn & (PAGES_PER_SECTION - 1)) == 0) {