Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2725393imj; Mon, 18 Feb 2019 11:00:47 -0800 (PST) X-Google-Smtp-Source: AHgI3IZiYtFLG4S4o9IXrd9+uZSEPOHES5Xv6XQi71BDwlAwfiirUZ0nT4SyfK5jgg4xVxebi4/q X-Received: by 2002:a62:b248:: with SMTP id x69mr25423835pfe.256.1550516447231; Mon, 18 Feb 2019 11:00:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550516447; cv=none; d=google.com; s=arc-20160816; b=fHavq8WWK0+EjTXNP4zWsV3xxTRYB0IDH/dPpSANCXJExyWjay37SfYvgnCnbeteOh qn+UCEnUx5PkPca1zH/NQrEsbM6kL+No6KlYk7U3sus++Zt3RjBPbFpJZrjra4hnRq6u IlEwb0pipiRpeBQA632p1UtVJYkV4efcjxQ4vJfg9+cwvkzNHgJfxiy9/LrpjuXSJ2Th BcL87jhYa5u9RI2MuAVXQ65jt2bfY7iS+Odg19EtyKLXneBL1DQ9Ccv+ewNXf2ozCcuA YxZPmkKTc7YSUHeMeMFM0eCz+hrMDW37dVJuXJyj9oqyTFttY4238cSwoUxD1nAmL0h8 Vc4Q== 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:message-id :mime-version:references:in-reply-to:subject:cc:to:from:date; bh=tYLL3g5oKvGO1iFIPlillqB97Avzk6nxCNSZYyIY/tE=; b=bhFb98HG6trpcIek4UAIyXfesNJSPyZ/sN/eHmoFxFIepXCBsqKCiYHFruRRsU77xF UilxaTF2xiu3CIN2ISfsISiIisOR6xVCKHyFyipbghM4l6ba1zkvGH7/e5TSBdw40DON BzAPpQpcXycp2nSanSnhNRJE0Di6NSfS8SEm4PYkD06FpEq6iR4HEEH5I1CIZzT+0mTN y2/wYol+Bia9XuMcq+IvYyMxRKLWsbqceJmBTa3ecG4mo3dvYPVL8kI40PHLArc789NF t18WKoQ5FA+zQWABdAPkt4Rnr4HQYyerVCGq4kFbrvxx/GgKnqUtFZM/SnXpiRu21sOB B0mQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2si12873122pgq.310.2019.02.18.11.00.31; Mon, 18 Feb 2019 11:00:47 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732888AbfBRRVO convert rfc822-to-8bit (ORCPT + 99 others); Mon, 18 Feb 2019 12:21:14 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42300 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726380AbfBRRVN (ORCPT ); Mon, 18 Feb 2019 12:21:13 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1IHKAmo119458 for ; Mon, 18 Feb 2019 12:21:12 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qqx03jn5r-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Feb 2019 12:21:11 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Feb 2019 17:21:10 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 18 Feb 2019 17:21:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1IHL7RP10027116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 18 Feb 2019 17:21:07 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41ECF42045; Mon, 18 Feb 2019 17:21:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 111FC4203F; Mon, 18 Feb 2019 17:21:07 +0000 (GMT) Received: from mschwideX1 (unknown [9.152.212.164]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 18 Feb 2019 17:21:07 +0000 (GMT) Date: Mon, 18 Feb 2019 18:21:06 +0100 From: Martin Schwidefsky To: Guenter Roeck Cc: Heiko Carstens , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] s390/setup: fix early warning messages In-Reply-To: <20190218180146.79930fe6@mschwideX1> References: <20190218154640.GA27699@roeck-us.net> <20190218180146.79930fe6@mschwideX1> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19021817-0016-0000-0000-00000257E0B9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021817-0017-0000-0000-000032B2219E Message-Id: <20190218182106.61b10ee4@mschwideX1> Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 8BIT X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-18_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902180129 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: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 = { -- 2.16.4 -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.