From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35135C433FE for ; Thu, 10 Dec 2020 20:52:22 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CE35823E25 for ; Thu, 10 Dec 2020 20:52:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE35823E25 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.49906.88249 (Exim 4.92) (envelope-from ) id 1knSuq-0001Wa-Ua; Thu, 10 Dec 2020 20:51:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 49906.88249; Thu, 10 Dec 2020 20:51:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knSuq-0001WT-RG; Thu, 10 Dec 2020 20:51:56 +0000 Received: by outflank-mailman (input) for mailman id 49906; Thu, 10 Dec 2020 20:51:56 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knSuq-0001WO-Fn for xen-devel@lists.xenproject.org; Thu, 10 Dec 2020 20:51:56 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1knSup-0000pp-3t; Thu, 10 Dec 2020 20:51:55 +0000 Received: from [54.239.6.185] (helo=a483e7b01a66.ant.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1knSuo-0006EB-SO; Thu, 10 Dec 2020 20:51:55 +0000 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" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject; bh=ZMMdUx0x9wYMaOKo/RzR5w8M61hVMj8XIkOz66DqnpI=; b=2FF2cY1USmHb7fD+gLJugPnjQa vCu0p/vD4VWjbFH54bg/+3+xOju1+r9n94MkCKO0pQ1py3psWhuaKkyuLDMfH6wR/hO/libdfR+Nl FGirN/vRF+77kxXEQOj7P/AhzcCCMpqZpTz28UsHWO7OXArwbpR7QKFX5VhMOgYQduh4=; Subject: Re: [PATCH v3] xen: add support for automatic debug key actions in case of crash To: Jan Beulich Cc: Andrew Cooper , George Dunlap , Ian Jackson , Stefano Stabellini , Wei Liu , Volodymyr Babchuk , xen-devel@lists.xenproject.org, Juergen Gross References: <20201126080340.6154-1-jgross@suse.com> <22190c77-eb35-5b72-7d72-34800c3f052f@suse.com> <98c45abd-8796-088c-e2a6-9ad494beeb9e@xen.org> <59f126a3-f716-345b-b464-746e6156c15a@suse.com> From: Julien Grall Message-ID: <1e305cf6-aa14-54cc-a77d-88bb38ba4c6e@xen.org> Date: Thu, 10 Dec 2020 20:51:52 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <59f126a3-f716-345b-b464-746e6156c15a@suse.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Hi Jan, On 09/12/2020 14:29, Jan Beulich wrote: > On 09.12.2020 13:11, Julien Grall wrote: >> On 26/11/2020 11:20, Jan Beulich wrote: >>> On 26.11.2020 09:03, Juergen Gross wrote: >>>> When the host crashes it would sometimes be nice to have additional >>>> debug data available which could be produced via debug keys, but >>>> halting the server for manual intervention might be impossible due to >>>> the need to reboot/kexec rather sooner than later. >>>> >>>> Add support for automatic debug key actions in case of crashes which >>>> can be activated via boot- or runtime-parameter. >>>> >>>> Depending on the type of crash the desired data might be different, so >>>> support different settings for the possible types of crashes. >>>> >>>> The parameter is "crash-debug" with the following syntax: >>>> >>>> crash-debug-= >>>> >>>> with being one of: >>>> >>>> panic, hwdom, watchdog, kexeccmd, debugkey >>>> >>>> and a sequence of debug key characters with '+' having the >>>> special semantics of a 10 millisecond pause. >>>> >>>> So "crash-debug-watchdog=0+0qr" would result in special output in case >>>> of watchdog triggered crash (dom0 state, 10 ms pause, dom0 state, >>>> domain info, run queues). >>>> >>>> Signed-off-by: Juergen Gross >>>> --- >>>> V2: >>>> - switched special character '.' to '+' (Jan Beulich) >>>> - 10 ms instead of 1 s pause (Jan Beulich) >>>> - added more text to the boot parameter description (Jan Beulich) >>>> >>>> V3: >>>> - added const (Jan Beulich) >>>> - thorough test of crash reason parameter (Jan Beulich) >>>> - kexeccmd case should depend on CONFIG_KEXEC (Jan Beulich) >>>> - added dummy get_irq_regs() helper on Arm >>>> >>>> Signed-off-by: Juergen Gross >>> >>> Except for the Arm aspect, where I'm not sure using >>> guest_cpu_user_regs() is correct in all cases, >> >> I am not entirely sure to understand what get_irq_regs() is supposed to >> returned on x86. Is it the registers saved from the most recent exception? > > An interrupt (not an exception) sets the underlying per-CPU > variable, such that interested parties will know the real > context is not guest or "normal" Xen code, but an IRQ. Thanks for the explanation. I am a bit confused to why we need to give a regs to handle_keypress() because no-one seems to use it. Do you have an explanation? To add to the confusion, it looks like that get_irqs_regs() may return NULL. So sometimes we may pass guest_cpu_regs() (which may contain garbagge or a set too far). I guess providing the wrong information to handle_keypress() is not going to matter that much because no-one use it (?). Although, I'd like to make sure this is not going to bite us in the future. Cheers, -- Julien Grall