From nobody Sun Feb 8 19:39:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1607932605; cv=none; d=zohomail.com; s=zohoarc; b=bNjsHdY3JYhErKIlgc5a+UV2myAQYhVW0RB+OP90GAK7wYovssSqL40eruiGt8zVpFl5Dt72SP7T9gUNQEy/n7gGj9jIr1zd5+RhTbMz1HuqFiW7uCwNS1Pj+DNN0VWf7TGBUCXHp2OYZmzGCvTUUTJAHRTpXaDvjeUg8x1LFDs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607932605; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KnYqlf/P+S7NcIzAGFzhLoCYbM4Ex5RUcFQo+09bQv0=; b=gwgFYLY1JbfgnAAC7VnQHeBNAZ67wGo6qISvHvKbmJjPAqN3AB02mB9dzEL0iee/yfX+ufppfVeVB/mR46XLGpv12IhSCYVBAeUY8dY/Zd5E4gT7IJi/Psn4MIu9s4IU5MLV0y8to4LWJVbvvJcoOmW8l8hBOTAAExTMojUwOII= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine 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 160793260545131.479705831344063; Sun, 13 Dec 2020 23:56:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.51923.90841 (Exim 4.92) (envelope-from ) id 1koiiU-000863-0j; Mon, 14 Dec 2020 07:56:22 +0000 Received: by outflank-mailman (output) from mailman id 51923.90841; Mon, 14 Dec 2020 07:56:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1koiiT-00085w-TL; Mon, 14 Dec 2020 07:56:21 +0000 Received: by outflank-mailman (input) for mailman id 51923; Mon, 14 Dec 2020 07:56:20 +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.92) (envelope-from ) id 1koiiS-00084z-9R for xen-devel@lists.xenproject.org; Mon, 14 Dec 2020 07:56:20 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9baafd8a-bc33-4ffc-8299-c22e92bc3d06; Mon, 14 Dec 2020 07:56:18 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B1377AD4D; Mon, 14 Dec 2020 07:56:17 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9baafd8a-bc33-4ffc-8299-c22e92bc3d06 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1607932577; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KnYqlf/P+S7NcIzAGFzhLoCYbM4Ex5RUcFQo+09bQv0=; b=JMIzCIoqvl+4Kk85zJ96fL3dk1LmsPf7Eh90am/VZ8i3hIbfNMeKcneb9ggiJJlXwZqy9a 5mdT6doWSYcEioBQeFwH+n+Ukf3MXE53xbmkeT+fHY/gn7OI/soD0d+F3La1R9/3W1sM5N tAjNq8oW73Uxicw76ymhKMK82ifFKZE= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Andrew Cooper , George Dunlap , Ian Jackson , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v4 2/3] xen: enable keyhandlers to work without register set specified Date: Mon, 14 Dec 2020 08:56:14 +0100 Message-Id: <20201214075615.25038-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201214075615.25038-1-jgross@suse.com> References: <20201214075615.25038-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There are only two keyhandlers which make use of the cpu_user_regs struct passed to them. In order to be able to call any keyhandler in non-interrupt contexts, too, modify those two handlers to copy with a NULL regs pointer by using run_in_exception_handler() in that case. Suggested-by: Julien Grall Signed-off-by: Juergen Gross --- V4: - new patch --- xen/common/keyhandler.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 68364e987d..de120fa092 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -181,7 +181,10 @@ static void dump_registers(unsigned char key, struct c= pu_user_regs *regs) cpumask_copy(&dump_execstate_mask, &cpu_online_map); =20 /* Get local execution state out immediately, in case we get stuck. */ - dump_execstate(regs); + if ( regs ) + dump_execstate(regs); + else + run_in_exception_handler(dump_execstate); =20 /* Alt. handling: remaining CPUs are dumped asynchronously one-by-one.= */ if ( alt_key_handling ) @@ -481,15 +484,24 @@ static void run_all_keyhandlers(unsigned char key, st= ruct cpu_user_regs *regs) tasklet_schedule(&run_all_keyhandlers_tasklet); } =20 -static void do_debug_key(unsigned char key, struct cpu_user_regs *regs) +/* run_in_exception_handler() on Arm requires globally visible symbol. */ +void do_debugger_trap_fatal(struct cpu_user_regs *regs) { - printk("'%c' pressed -> trapping into debugger\n", key); (void)debugger_trap_fatal(0xf001, regs); =20 /* Prevent tail call optimisation, which confuses xendbg. */ barrier(); } =20 +static void do_debug_key(unsigned char key, struct cpu_user_regs *regs) +{ + printk("'%c' pressed -> trapping into debugger\n", key); + if ( regs ) + do_debugger_trap_fatal(regs); + else + run_in_exception_handler(do_debugger_trap_fatal); +} + static void do_toggle_alt_key(unsigned char key, struct cpu_user_regs *reg= s) { alt_key_handling =3D !alt_key_handling; --=20 2.26.2