Received: by 10.223.185.116 with SMTP id b49csp6915125wrg; Wed, 28 Feb 2018 18:47:07 -0800 (PST) X-Google-Smtp-Source: AG47ELu3LGbqhTRyanRC7XHyerU4PbxiRr25k1d4xSgo7LnicU1hCtUeSQJTt5lZbY/QMXKOv8k+ X-Received: by 2002:a17:902:4203:: with SMTP id g3-v6mr335455pld.143.1519872427127; Wed, 28 Feb 2018 18:47:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519872427; cv=none; d=google.com; s=arc-20160816; b=Mhyu4yFN8xOE2/yiDGJmCnLOzqC+YugS4v+TaSz9KxZl4BWbaxTjPHbphTsZkSYRS8 nCQUCXs4LTGG19s904dlGbXM7Z0pzEpLQFucyvvsfs5x4ay2/Nenyp/2SD5m8pLmU2lQ tD5GbMRMKyuU2vd0icpAHZWgewcquUqLQkAd27xgAuReTpHhsb0syNT8ZehpJdGLZu09 THghrguSGphTAemf4a2fOoxTjcCR+S0U9U3ZQksK3IgL+j2YQRUrodsYhUoFittk57fe L6lXqQtY6hYLjhLbTczc2kraGELrxvExNX9LgU/JvjE0ie8njR+JCDV7+JxFkmWdzbFm bDGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=U06xagZlnCLOT9+pb8hyS4kZuIDrLs3hnI8wAmbn8W4=; b=cECO5YzsobILbtxmMkwDgI885YM4UPpC0O1CLEx34jtxE2L4QqLH4L1R+jkfl4h2KA hVfJqI5LG5m8SLAtVhXWM2FUj70sBcBSzEHAfVueGYJIT52zDDet51cdEuTRng8hDsma nYVuXfoZNZPAFyWjDHRVYl23VsC5zB1u3YYlpI7QZPOwj9jUelrBtEN8topTUNoK/td0 q7Ruwn498mRdib3CS001JomEUeqpg1YUqtOUx290fcl8TlN77gTiyYG6VzfC3LAFWphA CrDLywb01LYG7YKuY8Br8oEpwLyGMzABqJLQA8NKKZxX6KVzCGOIw9ZgZRne6Xm60pas LZNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hVV4f6ZL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8-v6si2270082pli.490.2018.02.28.18.46.52; Wed, 28 Feb 2018 18:47:07 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hVV4f6ZL; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965524AbeCACpa (ORCPT + 99 others); Wed, 28 Feb 2018 21:45:30 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:45832 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965468AbeCACp1 (ORCPT ); Wed, 28 Feb 2018 21:45:27 -0500 Received: by mail-io0-f194.google.com with SMTP id m22so5484669iob.12 for ; Wed, 28 Feb 2018 18:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=U06xagZlnCLOT9+pb8hyS4kZuIDrLs3hnI8wAmbn8W4=; b=hVV4f6ZLcL1YUuyfxtglfztAzecGuLx+Pg1i5WjT5yVOLkY4Kwtj5W/7zEzslrHtvU uGuSRZoHarZBBLDH7vIpgwo665OBm/Cm46OTQAF6D3iPLHrj1Vkzk712xwKMpgO4O7iF 4kTxXgVLz23y5jiF3zNnsqW/suE7bX2Y8aDi59TnB1Vy0gItdm3w1OPsOVZIo+JIbi/h FETKleQr70pTt28lSXN3xArBeWduo+dSzg4pP220doyh35/5x80TZokS1gi8/aDnw0aM UEb1MyPxnBmmZhxTwbbGpQS3XXC0bHWemVFifzYiOuTTP8BIEhQrmkFvGUayOtaCMFkm NBIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=U06xagZlnCLOT9+pb8hyS4kZuIDrLs3hnI8wAmbn8W4=; b=E/Q0K7E+UUkoOFwNR+AxlK+v+nY/La0SN9inuyPgUftB/6wJdV8ivKRxXFNruqjjWy c91Ggz/l2AMVZ62Ft/zfd5GKdzRkeWtAfu1D4/ufQQOz3vA7r19M1fMqaZBWJyAcDgEh Kd/uIwez+FJp9TxQxKYRpjSFwl/Na7XeSUhPuMDvEnB9W/EBnv/Tv94y8B3pL7BIXsfX 5PQGG71UwJ3ZRC0ayv55QvLWtdLQuZ+H6kjYWSpRupt9345pCnn48g9g6bmIFsWfiRJ0 RIbs3ES7Bt79V8WgFbEYNXUPFqOXPDxdB0c4vNfWRlcenr45TTQcFvURJcLcIQaui74W FuUA== X-Gm-Message-State: APf1xPDbFoIMIqm+g2CNJKQCDU1hqqtxsfcXF1CZTvYlrhzP/7NDFjdX DBD6YWIOCMACg6xFTkOx2A== X-Received: by 10.107.159.208 with SMTP id i199mr328143ioe.42.1519872327093; Wed, 28 Feb 2018 18:45:27 -0800 (PST) Received: from [120.7.1.38] (24-212-162-55.cable.teksavvy.com. [24.212.162.55]) by smtp.gmail.com with ESMTPSA id 65sm2183571iov.52.2018.02.28.18.45.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Feb 2018 18:45:26 -0800 (PST) Subject: Re: 4.16 regression: s2ram broken on non-PAE i686 To: Thomas Gleixner Cc: Linux Kernel List , the arch/x86 maintainers , William Grant References: From: Woody Suwalski Message-ID: <80bffdab-be19-17f3-f3ba-bf96050130ee@gmail.com> Date: Wed, 28 Feb 2018 21:45:25 -0500 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thomas Gleixner wrote: > Woody, > > On Wed, 28 Feb 2018, Woody Suwalski wrote: >> Certainly. I understand you want dmesg output for kernels build with and >> without PAE, not just PAE=n on the cmdline :-) >> Here it is... > Thanks for providing the data. It did not pinpoint the issue but at least > it gave me the hint to look into the right direction. > > Does the patch below fix the issue for you? It's untested as I'm at home > and have no access to a 32bit machine right now. > > Thanks, > > tglx > > 8<------------------ > Subject: x86/cpu_entry_area: Sync cpu_entry_area to initial_page_table > From: Thomas Gleixner > Date: Wed, 28 Feb 2018 21:14:26 +0100 > > The separation of the cpu_entry_area from the fixmap missed the fact that > on 32bit non-PAE kernels the cpu_entry_area mapping might not be covered in > initial_page_table by the previous synchronizations. > > This results in suspend/resume failures because 32bit utilizes initial page > table for resume. The absence of the cpu_entry_area mapping results in a > triple fault, aka. insta reboot. > > Synchronize the initial page table after setting up the cpu entry > area. Instead of adding yet another copy of the same code, move it to a > function and invoke it from the various places. > > It needs to be investigated if the existing calls in setup_arch() and > setup_per_cpu_areas() can be replaced by the later invocation from > setup_cpu_entry_areas(), but that's beyond the scope of this fix. > > Fixes: 92a0f81d8957 ("x86/cpu_entry_area: Move it out of the fixmap") > Reported-by: Woody Suwalski > Signed-off-by: Thomas Gleixner > Cc: stable@vger.kernel.org > --- > arch/x86/include/asm/pgtable_32.h | 1 + > arch/x86/include/asm/pgtable_64.h | 1 + > arch/x86/kernel/setup.c | 17 +++++------------ > arch/x86/kernel/setup_percpu.c | 17 ++++------------- > arch/x86/mm/cpu_entry_area.c | 6 ++++++ > arch/x86/mm/init_32.c | 15 +++++++++++++++ > 6 files changed, 32 insertions(+), 25 deletions(-) > > --- a/arch/x86/include/asm/pgtable_32.h > +++ b/arch/x86/include/asm/pgtable_32.h > @@ -32,6 +32,7 @@ extern pmd_t initial_pg_pmd[]; > static inline void pgtable_cache_init(void) { } > static inline void check_pgt_cache(void) { } > void paging_init(void); > +void sync_initial_page_table(void); > > /* > * Define this if things work differently on an i386 and an i486: > --- a/arch/x86/include/asm/pgtable_64.h > +++ b/arch/x86/include/asm/pgtable_64.h > @@ -28,6 +28,7 @@ extern pgd_t init_top_pgt[]; > #define swapper_pg_dir init_top_pgt > > extern void paging_init(void); > +static inline void sync_initial_page_table(void) { } > > #define pte_ERROR(e) \ > pr_err("%s:%d: bad pte %p(%016lx)\n", \ > --- a/arch/x86/kernel/setup.c > +++ b/arch/x86/kernel/setup.c > @@ -1204,20 +1204,13 @@ void __init setup_arch(char **cmdline_p) > > kasan_init(); > > -#ifdef CONFIG_X86_32 > - /* sync back kernel address range */ > - clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, > - swapper_pg_dir + KERNEL_PGD_BOUNDARY, > - KERNEL_PGD_PTRS); > - > /* > - * sync back low identity map too. It is used for example > - * in the 32-bit EFI stub. > + * Sync back kernel address range. > + * > + * FIXME: Can the later sync in setup_cpu_entry_areas() replace > + * this call? > */ > - clone_pgd_range(initial_page_table, > - swapper_pg_dir + KERNEL_PGD_BOUNDARY, > - min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); > -#endif > + sync_initial_page_table(); > > tboot_probe(); > > --- a/arch/x86/kernel/setup_percpu.c > +++ b/arch/x86/kernel/setup_percpu.c > @@ -287,24 +287,15 @@ void __init setup_per_cpu_areas(void) > /* Setup cpu initialized, callin, callout masks */ > setup_cpu_local_masks(); > > -#ifdef CONFIG_X86_32 > /* > * Sync back kernel address range again. We already did this in > * setup_arch(), but percpu data also needs to be available in > * the smpboot asm. We can't reliably pick up percpu mappings > * using vmalloc_fault(), because exception dispatch needs > * percpu data. > + * > + * FIXME: Can the later sync in setup_cpu_entry_areas() replace > + * this call? > */ > - clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, > - swapper_pg_dir + KERNEL_PGD_BOUNDARY, > - KERNEL_PGD_PTRS); > - > - /* > - * sync back low identity map too. It is used for example > - * in the 32-bit EFI stub. > - */ > - clone_pgd_range(initial_page_table, > - swapper_pg_dir + KERNEL_PGD_BOUNDARY, > - min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); > -#endif > + sync_initial_page_table(); > } > --- a/arch/x86/mm/cpu_entry_area.c > +++ b/arch/x86/mm/cpu_entry_area.c > @@ -163,4 +163,10 @@ void __init setup_cpu_entry_areas(void) > > for_each_possible_cpu(cpu) > setup_cpu_entry_area(cpu); > + > + /* > + * This is the last essential update to swapper_pgdir which needs > + * to be synchronized to initial_page_table on 32bit. > + */ > + sync_initial_page_table(); > } > --- a/arch/x86/mm/init_32.c > +++ b/arch/x86/mm/init_32.c > @@ -453,6 +453,21 @@ static inline void permanent_kmaps_init( > } > #endif /* CONFIG_HIGHMEM */ > > +void __init sync_initial_page_table(void) > +{ > + clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, > + swapper_pg_dir + KERNEL_PGD_BOUNDARY, > + KERNEL_PGD_PTRS); > + > + /* > + * sync back low identity map too. It is used for example > + * in the 32-bit EFI stub. > + */ > + clone_pgd_range(initial_page_table, > + swapper_pg_dir + KERNEL_PGD_BOUNDARY, > + min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); > +} > + > void __init native_pagetable_init(void) > { > unsigned long pfn, va; Thanks for the patch, good news, it did fix the problem. I did 2 builds and both worked OK over the s2ram cycle. It will be necessary to add the patch to 4.15-stable and 4.14-stable, I believe that both have now broken s2ram. I will build tomorrow 4.15 and 4.14 with your patch and try it out - the patch seems to apply OK to 4.15.7 and 4.14.23... Thanks, Woody