From nobody Thu Apr 25 09:12:50 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1570126419; cv=none; d=zoho.com; s=zohoarc; b=Koimf8Mq3GtWfIQn3g/49NKovtDAObW9NT+KRThlCWdSG7gluwwcw9znaVvlNrMSJ984HpP9NRnwjsebBZuZXIb8xVa3qgBlKoEZyHHU8mcGuY0vQERJKr8lyfQveGzDmF5fnmFjV0slvalcf7MBEAlZ2gR8cMohpkTZCMpiM14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570126419; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=gBCdZxTUhu6jbOWWhHZBVLXgmdQGxUPG0gZ4GHTSLhg=; b=d1R677BjjHQXAo7Ql+5iyeQUYBSNO+VIh6PRc6WFgCaUen3AoPobkbFamR7JyqKPSv8yviPPJa2CuEoCnHT9WEsEZ/FnQMjEJPNNIBGu0YcKFNrpdgvEC9JTOq7HKV/mf7xkwYnRjsTJ9UlZ9yr7GN4xrD9/X0iutqDBgQiUMEA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570126419096600.944084507666; Thu, 3 Oct 2019 11:13:39 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iG5aQ-0000uq-LA; Thu, 03 Oct 2019 18:12:22 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iG5aO-0000ul-VA for xen-devel@lists.xenproject.org; Thu, 03 Oct 2019 18:12:21 +0000 Received: from userp2130.oracle.com (unknown [156.151.31.86]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 56470168-e609-11e9-9730-12813bfff9fa; Thu, 03 Oct 2019 18:12:19 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x93HsYMW089402; Thu, 3 Oct 2019 18:12:14 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2v9xxv658v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Oct 2019 18:12:14 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x93Hwdqr074410; Thu, 3 Oct 2019 18:12:13 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2vcx72wd3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 Oct 2019 18:12:13 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x93ICCXt013176; Thu, 3 Oct 2019 18:12:12 GMT Received: from bostrovs-us.us.oracle.com (/10.152.32.65) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Oct 2019 11:12:12 -0700 X-Inumbo-ID: 56470168-e609-11e9-9730-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2019-08-05; bh=bs57jL07nzAKqfhU6u+MUrWsx1PltL4Qn+aLCBDHeOE=; b=XxAq3iVAqPyJHd22CISPSL1FT5sD9yclaDy2qGzbWLn2FKLaYO3orGq48o4jUYx26bi0 rwldv7VsCbThyxzi/aINlUpFALi3NGFLvJKb9dCJjHhkrzz44iCmCYDQngxbhA3WeAXE VO5x4N0QBn79AsRnz2yQXr1PQvA0L79mNNEur36yPLaeNRlm64q1SE9sf5Nrmz6YgGBM qW57b1hVKowS00UpHoea7j4aaMndKQJfOPuHtZI8ABg/fTxjhrsIpsVMrsOT19mENk7i QY/kxMF4qZuBXIh+kwP+uVbu4kF5M+lLsD4KGdWpa68aQ+pVmQ3gtVjorHNPJ4OuEXGf WQ== From: Boris Ostrovsky To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Date: Thu, 3 Oct 2019 14:12:03 -0400 Message-Id: <20191003181203.22405-1-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9399 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910030151 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9399 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default 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-1908290000 definitions=main-1910030151 Subject: [Xen-devel] [PATCH v2] x86/xen: Return from panic notifier X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: jgross@suse.com, jbeulich@suse.com, james@dingwall.me.uk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Currently execution of panic() continues until Xen's panic notifier (xen_panic_event()) is called at which point we make a hypercall that never returns. This means that any notifier that is supposed to be called later as well as significant part of panic() code (such as pstore writes from kmsg_dump()) is never executed. There is no reason for xen_panic_event() to be this last point in execution since panic()'s emergency_restart() will call into xen_emergency_restart() from where we can perform our hypercall. Nevertheless, we will provide xen_legacy_crash boot option that will preserve original behavior during crash. This option could be used, for example, if running kernel dumper (which happens after panic notifiers) is undesirable. Reported-by: James Dingwall Signed-off-by: Boris Ostrovsky Reviewed-by: Juergen Gross --- v2: Added xen_legacy_crash boot option to preserve current behaviour. My earlier suggestion to create an external dumper (for Xen toolstack) had some corner cases and dealing with them was becoming too much logic for my taste. .../admin-guide/kernel-parameters.txt | 4 +++ arch/x86/xen/enlighten.c | 28 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index 4c1971960afa..5ea005c9e2d6 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -5267,6 +5267,10 @@ the unplug protocol never -- do not unplug even if version check succeeds =20 + xen_legacy_crash [X86,XEN] + Crash from Xen panic notifier, without executing late + panic() code such as dumping handler. + xen_nopvspin [X86,XEN] Disables the ticketlock slowpath using Xen PV optimizations. diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 750f46ad018a..205b1176084f 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -269,19 +269,41 @@ void xen_reboot(int reason) BUG(); } =20 +static int reboot_reason =3D SHUTDOWN_reboot; +static bool xen_legacy_crash; void xen_emergency_restart(void) { - xen_reboot(SHUTDOWN_reboot); + xen_reboot(reboot_reason); } =20 static int xen_panic_event(struct notifier_block *this, unsigned long event, void *pt= r) { - if (!kexec_crash_loaded()) - xen_reboot(SHUTDOWN_crash); + if (!kexec_crash_loaded()) { + if (xen_legacy_crash) + xen_reboot(SHUTDOWN_crash); + + reboot_reason =3D SHUTDOWN_crash; + + /* + * If panic_timeout=3D=3D0 then we are supposed to wait forever. + * However, to preserve original dom0 behavior we have to drop + * into hypervisor. (domU behavior is controlled by its + * config file) + */ + if (panic_timeout =3D=3D 0) + panic_timeout =3D -1; + } return NOTIFY_DONE; } =20 +static int __init parse_xen_legacy_crash(char *arg) +{ + xen_legacy_crash =3D true; + return 0; +} +early_param("xen_legacy_crash", parse_xen_legacy_crash); + static struct notifier_block xen_panic_block =3D { .notifier_call =3D xen_panic_event, .priority =3D INT_MIN --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel