Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1108183rdf; Sat, 4 Nov 2023 06:54:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPBX8C0ce4Oy38CRWzhf/8fLgzyJAxvzEBJJusrNGj2hCY1CBhByILwpupFUgdG9T+xX0d X-Received: by 2002:a1f:1993:0:b0:495:c10c:ec39 with SMTP id 141-20020a1f1993000000b00495c10cec39mr22598751vkz.2.1699106049395; Sat, 04 Nov 2023 06:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699106049; cv=none; d=google.com; s=arc-20160816; b=wmj384/cdv+Ss2PRK2QBNcByvh5m1nzzPi12bZsKgKVzBKy1niVCY//UBdk5Xf11Ua gcyMBawSJtgc/9HTBfJupd5RlvbEK2RzUP5h+dWNn5a1wN0U2gKAsoDCx3iG0J5uWS4I CX56Wxmcnye2SiwTmKL+2/zqkGKVX6E/lQrjm/gtSZW/pydUS6hqavs5Ek0gm+Z7MlY6 Lff01VsWnEC5HtpQZBIQyD3vH9rCmg4GHKT7dkZQ4Ee4SCrcWD7cBWQ+f3h+oYlqY1oW EzwFwDESuplJFzliKUvNJcI48Tx+iGTx/JhL/iuxpL8dO3zBrPPMsWU7OV8S+lsaNlyf dAMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=u9xk5JMb+3F4j1upDtmwW6xPtQ6OpdlDE506X7n85to=; fh=4ATEPdFj4ZvqLkaF1r7tTd6pypil3tLTU9YpGxY1IDc=; b=X5GcFllEQwv25H+fs577zBdAvnmfBNEzny/IrPbjWftm6rwJtULEavp9bVueugsXtS 5IeZgDM0iMMbTWYOw1+XkiMVcgSUzQlN0vitOzBiJSC2m+6mgTZQhkRVPcnAFR6z4no6 j4LCKsISd3eU0B18bLl5JgiJUkYcLPC7MKLt6fBVc6T+K/CLZP9tm9e8d+1SA/T2AZfC egL5sWlzQP2t/gD38fqo300IuAciAJEA23/sWC8TD+r4N3Wk6Kr8DFWMdisGAbliXtAe nNMYOY3wbhUVBP8owwEehJLbuziLJ3beVYoy1R3oQ/VTLEK1jT63HzDINwYfP6z/SAQG /6ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=ZQaa68py; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l6-20020a17090a850600b0027916d248bbsi3825276pjn.162.2023.11.04.06.54.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 06:54:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=ZQaa68py; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 68FA180859BC; Sat, 4 Nov 2023 06:54:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbjKDNxn (ORCPT + 99 others); Sat, 4 Nov 2023 09:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjKDNxn (ORCPT ); Sat, 4 Nov 2023 09:53:43 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32464134 for ; Sat, 4 Nov 2023 06:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1699106017; bh=l5YIhhEsyNulzth2iXNgoY2WMDmvaFrvq7cXGxQrjyo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZQaa68pyY7ABmQAhd2GZwkCRvaGaz+5UBUL/AakPOWPUDjGsr8pd4ETZQGgz0reKi WwcgRpLlsb3bYioSmv4SBwQW3Wik9GZE8xtUk45Vz27hG/dMavVmMsoiaXGVByCr+Y kkUX95IKew215+eBXuI9lAazMNSLZ/63DHFKJVkY= Date: Sat, 4 Nov 2023 14:53:37 +0100 From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Greg Kroah-Hartman Cc: Arnd Bergmann , linux-kernel@vger.kernel.org, Zhangjin Wu , Willy Tarreau , Yuan Tan Subject: Re: [PATCH RFC] misc/pvpanic: add support for normal shutdowns Message-ID: <59ed7f70-2953-443e-9fa5-d46c566e4a08@t-8ch.de> References: <20231104-pvpanic-shutdown-v1-1-5ee7c9b3e301@weissschuh.net> <2023110407-unselect-uptight-b96d@gregkh> <365bbe1f-5ee8-40fe-bec0-53d9e7395c18@t-8ch.de> <2023110431-pacemaker-pruning-0e4c@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2023110431-pacemaker-pruning-0e4c@gregkh> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 04 Nov 2023 06:54:06 -0700 (PDT) On 2023-11-04 14:28:37+0100, Greg Kroah-Hartman wrote: > On Sat, Nov 04, 2023 at 02:16:53PM +0100, Thomas Weißschuh wrote: > > On 2023-11-04 14:05:02+0100, Greg Kroah-Hartman wrote: > > > On Sat, Nov 04, 2023 at 12:29:30PM +0100, Thomas Weißschuh wrote: > > > > Shutdown requests are normally hardware dependent. > > > > By extending pvpanic to also handle shutdown requests, guests can > > > > submit such requests with an easily implementable and cross-platform > > > > mechanism. > > > > > > > > Signed-off-by: Thomas Weißschuh > > > > --- > > > > The corresponding patch to qemu has also been submitted[0]. > > > > General discussions about the feature should happen on the other thread. > > > > > > > > [0] https://lore.kernel.org/qemu-devel/20231104-pvpanic-shutdown-v1-0-02353157891b@t-8ch.de/ > > > > --- > > > > drivers/misc/pvpanic/pvpanic.c | 19 +++++++++++++++++-- > > > > include/uapi/misc/pvpanic.h | 1 + > > > > 2 files changed, 18 insertions(+), 2 deletions(-) > > > > [..] > > > > > > diff --git a/include/uapi/misc/pvpanic.h b/include/uapi/misc/pvpanic.h > > > > index 54b7485390d3..82fc618bfbcf 100644 > > > > --- a/include/uapi/misc/pvpanic.h > > > > +++ b/include/uapi/misc/pvpanic.h > > > > @@ -5,5 +5,6 @@ > > > > > > > > #define PVPANIC_PANICKED (1 << 0) > > > > #define PVPANIC_CRASH_LOADED (1 << 1) > > > > +#define PVPANIC_SHUTDOWN (1 << 2) > > > > > > Why are these in a uapi file? > > > > They are ABI between qemu and its guest. > > But there's no interaction between Linux and userspace for these values, > so I would just drop them from here. There is one point where they are used: The pvpanic sysfs files 'events' and 'capability' contain numeric values which are using these constants. > > > The specification for these values is part of qemu but for some reason > > the header is part of Linux which is then imported back into qemu. > > > > I guess this has historical reasons, maybe because qemu doesn't really > > ship ABI headers and for Linux it's natural. > > That feels odd, are there other in-kernel examples of the Linux uapi > files being abused like this? Looking at qemu scripts/update-linux-headers.sh at least linux/qemu_fw_cfg.h and linux/pci_regs.h seem similar in that they are not directly related to Linux' own uapi. (Assuming you want *one* and not *all* examples) > > The real reason probably doesn't matter today as the header propably > > can't be dropped from Linux anyways for compatibility reasons. > > > > > And if they need to be here, why not use the proper BIT() macro for it? > > > > This was for uniformity with the existing code. > > I can send a (standalone?) patch to fix it up. > > If we keep it, sure, that would be nice. But let's try to drop it if > possible :) It will break the mentioned scripts/update-linux-headers.sh from qemu. Note: BIT() is part of include/vdso/bits.h which is not part of the uapi. How is it supposed to work? Some other uapi header also use BIT() but that seems to work by accident as the users have the macro defined themselves. Thomas