Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2757371imj; Mon, 18 Feb 2019 11:37:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IaXiUyk+VB40P5xCqtqzEGHPBgOYOQjMf1i1uAmlqZuxbapplrKEJk3oM8NtvZxWiLm2M/1 X-Received: by 2002:a17:902:6b03:: with SMTP id o3mr26950572plk.126.1550518674444; Mon, 18 Feb 2019 11:37:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550518674; cv=none; d=google.com; s=arc-20160816; b=DKvA22bgWGQcEzKejnAzrBZgBnObeLLd9azjT6Fn2fPHeamZ3f0oaidECUyyi99RjW qt0KuEZ3Ny7CYueLY0iI7ZzO01+4lZoVh4qtJL0jlFbRmHOGRA31qfKaAz5pbG9xB2LU U0DnRvpcv4F5kl9NKU1uMkOPWEB3AKSTlLYOYzxDhQDBGk4uZtN4dkgvZlgB/LU8vhuH zXzFdXjbksvLInNhFRxmLnXdFzcoN+WBf/W3I0lYQpVAiIydfaxLfHMVULQqjAUx+beb qFWHxf2JxMPzbVXO8BFqcJ4qN60GTEIXMZ74nIznd9VNGB7ct7Ly8imMRghbIcID/aPB 6GIQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Yp8xTP7a7/GsDd05ZL5jWnO7oKWOAPuXmNzaA5yfjx4=; b=dEY2VbVSn1wP2ns54737vTHH7TC3q7rx6lpjegXncQgCJ4/bSZysQf/9IctC8P1UWd Q1l7EYpT4jq4wMZTPMLDWzdOQNNhpGzXk0EuR+wfQV0sx8k2WYzM+e7o/WLL4yzelvFd woiYlgalwvs4ahy5QMXmkfmQzJoXh5pjzjSKyOorIRMa649hVq2RL0jbcy+8uojEK4S9 hdmbkD6ST8rC7+1dpj48m0+tLxK26ThIjPypuVQTM50g7/glAlRGYDi78dm58oA3DY4x CX4JUn7rTntPgO4dc3a9DFd5R+/rG1X7UKsc8CwHOz3W3B3iE07tqqE1iGUjOhoN5k4H zNkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=NQF92uXx; 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 r18si4983435pls.374.2019.02.18.11.37.39; Mon, 18 Feb 2019 11:37:54 -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=fail header.i=@gmail.com header.s=20161025 header.b=NQF92uXx; 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 S1726142AbfBRTWo (ORCPT + 99 others); Mon, 18 Feb 2019 14:22:44 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39147 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfBRTWo (ORCPT ); Mon, 18 Feb 2019 14:22:44 -0500 Received: by mail-pf1-f193.google.com with SMTP id f132so9047155pfa.6; Mon, 18 Feb 2019 11:22:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Yp8xTP7a7/GsDd05ZL5jWnO7oKWOAPuXmNzaA5yfjx4=; b=NQF92uXx/Aa9V2wh8L+Z9z3Os6cpDxgKGnK9Gi+AjOfZ4tM/CnY7mm2zkk2HjalBh7 rLu+95FwmCmACx+b7+3O7YIOAOzH8KUhMtjsZ0EqxUWDDBN6WWV/bhSaFuTnXfmZKktm GpXihFxAWkYVeEohaUauclCSpw0wZ28sX5v2MfXGu5naeRidMv59Xe6sPcxNg3w9MBu1 YEQ8cJ1MrbgDwn5B36DD5SaifsFViCU90f5RLHFtzoN9pCB/RPPLMo1FF3/Nn1p3BZoP 6bGEaSHubbtjNPkSFMWYt5QxRsyUcZFNE1B/1aYzzimOz58GRP4GR+XqPxwHJ0NCLQKN p9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Yp8xTP7a7/GsDd05ZL5jWnO7oKWOAPuXmNzaA5yfjx4=; b=uin/vqTuPuuAFNtIYuOY7DAsbSEKRt1j8KC5oJurBf7Vgc9FeQCpyEiE8WRizns3cG iIOXK6uB7tg2oTR5uOxngldt1i39XZMciTKHNOTRsY/od4qDgGyoqXlceYmpVQWt3Dxh 0RQfCnaUgvU/nZgBxyWK5uSYBmIPWCeFaauBm6n9sm2bfdl38hEZUPw/AZYZfMYGQ2Ah P0KrlgTpNVWQQAvIuddN5dV2DCIFuVBwIx2nqtsZ/FFH+SzrOt2LOuDIH4XrLu2CBE7M LLmtqP3p2gYpoK3+KqutiVqiAzyqvTvdIwgwLWWPIXYm5Y+EPTWzru+cPrVnVsWXWFyU VBtg== X-Gm-Message-State: AHQUAuYiKet0DPFnSdOCxBwDHDb4xmAdqN5suXAC5Go0k3kkGhvGTatL YPR6eo92C7/sXPetG498CpBQIfc1 X-Received: by 2002:a62:ca48:: with SMTP id n69mr25587616pfg.162.1550517762905; Mon, 18 Feb 2019 11:22:42 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 14sm20463764pgq.22.2019.02.18.11.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 11:22:41 -0800 (PST) Subject: Re: [PATCH] s390/setup: fix early warning messages To: Cornelia Huck , Martin Schwidefsky Cc: Heiko Carstens , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190218154640.GA27699@roeck-us.net> <20190218180146.79930fe6@mschwideX1> <20190218182106.61b10ee4@mschwideX1> <20190218191655.103c81ca.cohuck@redhat.com> From: Guenter Roeck Message-ID: <05e78442-07e1-9783-965f-b3d64a2c5e99@roeck-us.net> Date: Mon, 18 Feb 2019 11:22:40 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190218191655.103c81ca.cohuck@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Cornelia, On 2/18/19 10:16 AM, Cornelia Huck wrote: > 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. > What is your qemu command line ? Thanks, Guenter