Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2739065imj; Mon, 18 Feb 2019 11:15:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IYCROQfLQCPQVJ2l1kx1ZLisliy0LbwcwEyNPwUNMJB8evNDRu4mKlVKQy8WXZDGyrJ/+7T X-Received: by 2002:a63:d449:: with SMTP id i9mr3652571pgj.449.1550517304810; Mon, 18 Feb 2019 11:15:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550517304; cv=none; d=google.com; s=arc-20160816; b=UPa5PzgKLU6mIQPfpEIyPUWi12K9a/5yTTIExQDFHG43wQbHmFoh4RQDjQVKhe3yfG a2Z+7HM08GMPSlGXAjc3YAIPBZV9ycv7ZVqdHH5QpnFj7VLLKEef01iyVs5ZyUbAwdQ8 9Dr6SmvRaqZSIObvDFBDCknFK2sp/T5Gm4tiO62XIoeONWi5KzgmKI9vNn8MXUJgPpuY xC49AcwMbRstsTK6aFOqRXN7JdUayTyJMWWf4XmnLDxVmsICyuGBV/w7Of5V+8s1EA/D ytTvue5JEmKrRQ5n+qPf8Hwh3vsrpA6769N7+4dhp0xlxD0MvVh4a24Ea3qM82EY3uTv Hd3w== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=0sn0N45RLlKIV78JBN2Yd2rnClZG2jjUbwsU7xm2/y4=; b=g+qIheyxqSO+rh/5hWUqaPLSYXPE1xeweMqrAzYdnhTekrTN798XOYY2vkrK3AJb/o mFrd+auQhk3vAjUOVmRgbM5kDA5vfUuFw9bQpzgZQEytJMfnta0ztk21zOl5DBh0yuMz OZcBXCuT76KbnWn6lxUHZZunMtThWHO9LU/cFDkcMfT6E+z3rojinmBhiBGZpxz3+hzx xQRldDYikh8Jh98v1yPv0OV7GIVfOREDcXUmA9B7rKFjxMCgWJVGoK1c4EIZ6JURjkbu vhygrovPj/8oKoJ7qk+35STLINizC6lQ2Vdc9wTJM2Tk5OnNKUS7uTsHx7gDxxxCCayW IukQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f11si8746861plt.133.2019.02.18.11.14.48; Mon, 18 Feb 2019 11:15:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391964AbfBRSRB (ORCPT + 99 others); Mon, 18 Feb 2019 13:17:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730010AbfBRSRB (ORCPT ); Mon, 18 Feb 2019 13:17:01 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4684181F2F; Mon, 18 Feb 2019 18:17:00 +0000 (UTC) Received: from gondolin (ovpn-116-217.ams2.redhat.com [10.36.116.217]) by smtp.corp.redhat.com (Postfix) with ESMTP id D188A60139; Mon, 18 Feb 2019 18:16:58 +0000 (UTC) Date: Mon, 18 Feb 2019 19:16:55 +0100 From: Cornelia Huck To: Martin Schwidefsky Cc: Guenter Roeck , Heiko Carstens , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] s390/setup: fix early warning messages Message-ID: <20190218191655.103c81ca.cohuck@redhat.com> In-Reply-To: <20190218182106.61b10ee4@mschwideX1> References: <20190218154640.GA27699@roeck-us.net> <20190218180146.79930fe6@mschwideX1> <20190218182106.61b10ee4@mschwideX1> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 18 Feb 2019 18:17:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 18 Feb 2019 18:21:06 +0100 Martin Schwidefsky wrote: > On Mon, 18 Feb 2019 18:01:46 +0100 > Martin Schwidefsky wrote: > > > On Mon, 18 Feb 2019 07:46:40 -0800 > > Guenter Roeck wrote: > > > > > Hi, > > > > > > On Thu, Feb 14, 2019 at 03:40:56PM +0100, Martin Schwidefsky wrote: > > > > The setup_lowcore() function creates a new prefix page for the boot CPU. > > > > The PSW mask for the system_call, external interrupt, i/o interrupt and > > > > the program check handler have the DAT bit set in this new prefix page. > > > > > > > > At the time setup_lowcore is called the system still runs without virtual > > > > address translation, the paging_init() function creates the kernel page > > > > table and loads the CR13 with the kernel ASCE. > > > > > > > > Any code between setup_lowcore() and the end of paging_init() that has > > > > a BUG or WARN statement will create a program check that can not be > > > > handled correctly as there is no kernel page table yet. > > > > > > > > To allow early WARN statements initially setup the lowcore with DAT off > > > > and set the DAT bit only after paging_init() has completed. > > > > > > > > Cc: stable@vger.kernel.org > > > > Signed-off-by: Martin Schwidefsky > > > > > > This patch causes s390 qemu emulations to crash with a kernel stack overflow. > > > Reverting the patch fixes the problem. Crash log and bisect results below. > > > > Urgs, yes. That is EDAT-1 again that makes it work with 1MB pages but breaks > > with 4K mapping where the prefix page is mapped to absolute zero. > > > > Just using S390_lowcore instead of lowcore_ptr[0] does not work either > > because low-address protection is already active. I'll think of something. > > > > Thanks for bug report! > > This patch should fix the problem: > -- > From d4393e82c3ec9b2fe5dba4b0d1b6eef29f8d15c8 Mon Sep 17 00:00:00 2001 > From: Martin Schwidefsky > Date: Mon, 18 Feb 2019 18:10:08 +0100 > Subject: [PATCH] s390/setup: fix boot crash for machine without EDAT-1 > > The fix to make WARN work in the early boot code created a problem > on older machines without EDAT-1. The setup_lowcore_dat_on function > uses the pointer from lowcore_ptr[0] to set the DAT bit in the new > PSWs. That does not work if the kernel page table is set up with > 4K pages as the prefix address maps to absolute zero. > > To make this work the PSWs need to be changed with via address 0 in > form of the S390_lowcore definition. > > Cc: stable@vger.kernel.org > Fixes: 94f85ed3e2 ("s390/setup: fix early warning messages") > Signed-off-by: Martin Schwidefsky > --- > arch/s390/kernel/setup.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c > index 65b22ef5141a..12934e8fbb91 100644 > --- a/arch/s390/kernel/setup.c > +++ b/arch/s390/kernel/setup.c > @@ -451,13 +451,12 @@ static void __init setup_lowcore_dat_off(void) > > static void __init setup_lowcore_dat_on(void) > { > - struct lowcore *lc; > - > - lc = lowcore_ptr[0]; > - lc->external_new_psw.mask |= PSW_MASK_DAT; > - lc->svc_new_psw.mask |= PSW_MASK_DAT; > - lc->program_new_psw.mask |= PSW_MASK_DAT; > - lc->io_new_psw.mask |= PSW_MASK_DAT; > + __ctl_clear_bit(0, 28); > + S390_lowcore.external_new_psw.mask |= PSW_MASK_DAT; > + S390_lowcore.svc_new_psw.mask |= PSW_MASK_DAT; > + S390_lowcore.program_new_psw.mask |= PSW_MASK_DAT; > + S390_lowcore.io_new_psw.mask |= PSW_MASK_DAT; > + __ctl_set_bit(0, 28); > } > > static struct resource code_resource = { I could reproduce the crash under qemu/tcg and with this patch on top it is gone. Tested-by: Cornelia Huck