From nobody Mon Nov 25 05:14:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1717630748; cv=none; d=zohomail.com; s=zohoarc; b=gmvEy3nPWP2krybc1fb4vfkaIFB/N3fd3GQatjzb/CvspRRem+0OT3HNHT96vfryYj0NLyCakosWicgjhC3Aj7W7EzcxuC5DS24kfZj3rzwxsXdepi5D3TdA4+XotpdYBSybG3cacOh+kgjTQ7nwKurFZ23vgYdZg9+U2uKnVA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717630748; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kgYXT9TqVXX9/BRZFmbWBgRNk9wpbHrKyLXkpZBaJss=; b=adNtYaJn2TxV/wfuoVqnJ83fN+0L93SuMSEn0BaECA3RnzBCiytTIvp+JuDJrA2SRh3X8hR9A/O/FyGpedJIWIUqeQp666PbD0jB3Dv4VO/QyJY1AnAlGfHrqWBTuCZ/MUcAel4GbOBTjyhxTDSs++AP3tcSKMxxAU968yk2AQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717630748019684.0207936257742; Wed, 5 Jun 2024 16:39:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sF0Bm-0002mh-9X; Wed, 05 Jun 2024 19:37:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sF0Bl-0002fZ-B2 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 19:37:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sF0Bj-0005xc-O0 for qemu-devel@nongnu.org; Wed, 05 Jun 2024 19:37:05 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-345-BUjRHvrkP-CR60Y7VvTODw-1; Wed, 05 Jun 2024 19:37:02 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-35dca0dc826so240591f8f.1 for ; Wed, 05 Jun 2024 16:37:01 -0700 (PDT) Received: from redhat.com ([2.55.56.67]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c80582016sm7121466b.20.2024.06.05.16.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 16:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717630623; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kgYXT9TqVXX9/BRZFmbWBgRNk9wpbHrKyLXkpZBaJss=; b=VqTR4Xs6oE5iHuDABmn2/BjUNETIh10UWLCmvHaPMNn3RB9mPL8hSssJzoVUudTUqOvcEu KYnjPrG83T1eqw6uaDYMZYwbkeGstuhIpqTdE4hYQY3YeTxE1ioe3duGx+xuZJq8vF70mj M/ObOb7N767nBdL96tM6X70cVwT4MfI= X-MC-Unique: BUjRHvrkP-CR60Y7VvTODw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717630620; x=1718235420; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kgYXT9TqVXX9/BRZFmbWBgRNk9wpbHrKyLXkpZBaJss=; b=RzGPy/wlILB7/YTuWgz6U41OjtTLRzYFhV38klpwj8AwvC8RhpYiQPVAzIxvMBvphr 0CjwtljwfDlYCj/cBgGrD/RttgoW1Ie9wlHS61fVHZDBjvySSnewLonaTKvhfU1tleQv aYJReLdu0M3fupqlnA4rzwYq6kvPaP7gTdAGlwDaJfIUROmiMwTC6qV+5npSSaPb7rLR qlUvWpXp7JipBEUd1DGIbW+JRfrcgQpMCG0fwj+T9utWnQ6DhWJaJ66BOQXooXi9I9ln xEKx9pkEH1cfbfr2dSxGOYD8j9FFnrFtc2MJE1dmGih31yr+P4FuiHqE+CtiN9cSq7f2 0nEA== X-Gm-Message-State: AOJu0YwkbzqHmHykyoLfo3ivSmD311zvQSyG+N8QDLMNKmv65vA0BQFp AcM/0x7yq2DoHYpbR3VuEBLYw+K090grtFnUb/W0HozgZRB9+OgWioux1Y/fJtIYM0esUED9ACO bLQzUqxW2/yE9IxJ/nIF9wCLYip5fe4hj6aVLv9gSnEuiZycfihlSvcEdbmozWZ48NU6Y92kXfH asTeZTfKeNgdl+WpnHHW/wwtnrwAvVtA== X-Received: by 2002:a5d:64c4:0:b0:354:f7a4:7862 with SMTP id ffacd0b85a97d-35e883383bamr3125921f8f.19.1717630620303; Wed, 05 Jun 2024 16:37:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTn7lpYkgyQDTjc4R8v7mottzHj4Tj5yDZvbrsiaRQLlK1AuJmylfDT93c/JbXxLtTg0iWrQ== X-Received: by 2002:a5d:64c4:0:b0:354:f7a4:7862 with SMTP id ffacd0b85a97d-35e883383bamr3125907f8f.19.1717630619852; Wed, 05 Jun 2024 16:36:59 -0700 (PDT) Date: Wed, 5 Jun 2024 19:36:55 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alejandro Jimenez , Paolo Bonzini , Eric Blake , Markus Armbruster Subject: [PULL v3 37/41] pvpanic: Emit GUEST_PVSHUTDOWN QMP event on pvpanic shutdown signal Message-ID: <7572581002c9b8a74b4c4cf4f775652321068e56.1717630437.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1717630748412100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alejandro Jimenez Emit a QMP event on receiving a PVPANIC_SHUTDOWN event. Even though a typic= al SHUTDOWN event will be sent, it will be indistinguishable from a shutdown originating from other cases (e.g. KVM exit due to KVM_SYSTEM_EVENT_SHUTDOW= N) that also issue the guest-shutdown cause. A management layer application can detect the new GUEST_PVSHUTDOWN event to determine if the guest is using the pvpanic interface to request shutdowns. Signed-off-by: Alejandro Jimenez Message-Id: <20240527-pvpanic-shutdown-v8-6-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/run-state.json | 14 ++++++++++++++ system/runstate.c | 1 + 2 files changed, 15 insertions(+) diff --git a/qapi/run-state.json b/qapi/run-state.json index f8773f23b2..5ac0fec852 100644 --- a/qapi/run-state.json +++ b/qapi/run-state.json @@ -462,6 +462,20 @@ { 'event': 'GUEST_CRASHLOADED', 'data': { 'action': 'GuestPanicAction', '*info': 'GuestPanicInformation'= } } =20 +## +# @GUEST_PVSHUTDOWN: +# +# Emitted when guest submits a shutdown request via pvpanic interface +# +# Since: 9.1 +# +# Example: +# +# <- { "event": "GUEST_PVSHUTDOWN", +# "timestamp": { "seconds": 1648245259, "microseconds": 893771 } } +## +{ 'event': 'GUEST_PVSHUTDOWN' } + ## # @GuestPanicAction: # diff --git a/system/runstate.c b/system/runstate.c index 83055f3278..c149b1ab4b 100644 --- a/system/runstate.c +++ b/system/runstate.c @@ -587,6 +587,7 @@ void qemu_system_guest_crashloaded(GuestPanicInformatio= n *info) =20 void qemu_system_guest_pvshutdown(void) { + qapi_event_send_guest_pvshutdown(); qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); } =20 --=20 MST