Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6145779iog; Thu, 23 Jun 2022 12:17:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vJ+39EIVvferAZxjphapW0V6tv4VZQougTXaDjEXFKfEMSeD+PRtKFvbLNSTZmZZSruq5U X-Received: by 2002:a17:902:6901:b0:168:9bb4:7adb with SMTP id j1-20020a170902690100b001689bb47adbmr41347113plk.147.1656011840599; Thu, 23 Jun 2022 12:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011840; cv=none; d=google.com; s=arc-20160816; b=S+6j9wRz9iFfpyvMXRPgWkkUCw1nXo7kMJ4Ou9zExl+OyX293kD8ySLfB30lo2mlpH upwLulej9jCMPkuUends//nTAL7f9nr0Q1LCIS6rHZpDHAYqBbitCLcE+LC5EEQ0lV5a NoSErFblPw+WAcXj59MS41BDdArjEDSJKcPjr/Vxeu6pAECD403/tjQ9az5H6afpIiCP ZICNZB+TVarbmtQ1dBizVGNvE8LLbGrgwocvMmSCUBiNZwPlipJC5+lpuS6QXJy0zVBB 9M6QGA9grEaILQZZj5qI9WvYc6sQGvOuEHoJUfFgcbygVrYqZH44cCCIv2fSo8u5s17u rJNg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3p8qkhhjZhB0PmtULtzk5+YvtFjhA5CPcKFCG5vG65E=; b=IE0nb0wTe7XdySvN5otVaKc4ss+gP3rCUJszlZDd5oYVO8vJqEEidubNWs5jjs75+h cUUfmgyATSTBuEyjolnABtZBZsm3Kt7hdfEJpSbXNyXVrNuakx+ZHiWrZbrlvDNeY9Lg QUL04EoTcvX6J8UT6/VsE2Q9zWcs7bmnsv+0gd0Znuwd/fAtIeSlim2dYwPD7BLxGZ7S emVPF7VDwnZhHuU8FtaeUCdMEjJcQ1qT7Sn7hKhMhOhS37st6CLowy/hQ+viQeAuHevm aeFrovAd1MzaR7OFDNzo4gbmGV8e3o/tEZPfpEq4KKaYupIya/IM6q5CZukNFa0j+RzL r22w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Y27Bijte; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709026ac500b001678adeceecsi316852plt.384.2022.06.23.12.17.08; Thu, 23 Jun 2022 12:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Y27Bijte; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232915AbiFWRBD (ORCPT + 99 others); Thu, 23 Jun 2022 13:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232846AbiFWQsh (ORCPT ); Thu, 23 Jun 2022 12:48:37 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F604D243 for ; Thu, 23 Jun 2022 09:47:36 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id x1-20020a17090abc8100b001ec7f8a51f5so3196405pjr.0 for ; Thu, 23 Jun 2022 09:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3p8qkhhjZhB0PmtULtzk5+YvtFjhA5CPcKFCG5vG65E=; b=Y27BijteckmP4YbkgXlxhLDVpaMo1TcD7Wf3jMh77zBbeUqzgcl36shROKvYPKizD3 5jV3q0VKzONJLuyaiZjBu9depsn8jAMFosX9xAhqhpAidZW7G/m3se9SH3d6mAoLE252 OzQ2NUNXM1m69JDzfgvPjmHWN1PDFHRcERTCq3K/I4W5m1W3UjxDSNsnRONwyulrRBsv EfIDeAhXgy+CzqEQQbJd5K8ZyqoyWQw2CeQaGi2ocn6okkwkUS2ZLVDii/WjfKoX0x+H dnleGF1Kp323ACyCrdtuNwwRVid6zeWGfblKCTJryNXLKB8f052GPrTMt0yI5L79zCb/ rsuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3p8qkhhjZhB0PmtULtzk5+YvtFjhA5CPcKFCG5vG65E=; b=eiUYZ0NTHfirPSbAJw8NX9HE1aPywDYGSNJBin/5MH9DiiILqowBg7+tdtQAFB7YkX 9e2C4g1beVXQ4HkKjWedcfR19kQFhbZ0ARPSnaDPzVW767btBsuJr0yZ4hG7KWjKlBxS kPgS+gl1+PCZ5+umqiUlA2ZRl1OOx//FxkU1Z+BMso7HV2XsQNxWY9pMejugXRcMeSYK 5S2MNA5BKIRSdVvBxwK0cdQTSggvdwJCtNBJomsVbv6mRtMcIc4fw8ZOOAaKctIa/c/h zFQfnZ8Yl2nirvV+FssTMAJUc97RVewGLnLKbAdoxFOT0ZHZotBURkKgoj8ZlCk0ePhh W6UA== X-Gm-Message-State: AJIora/4Wv4/8po2kZLF0MdopE/CwANvUQpB2ezot2zjwjMXhlcz78++ lcphCT5MngvflXqfRPhPBMp2BQ== X-Received: by 2002:a17:90b:4b8f:b0:1ec:e852:22c7 with SMTP id lr15-20020a17090b4b8f00b001ece85222c7mr4903909pjb.38.1656002856050; Thu, 23 Jun 2022 09:47:36 -0700 (PDT) Received: from google.com (123.65.230.35.bc.googleusercontent.com. [35.230.65.123]) by smtp.gmail.com with ESMTPSA id v5-20020a17090a0c8500b001e2da6766ecsm2175967pja.31.2022.06.23.09.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jun 2022 09:47:35 -0700 (PDT) Date: Thu, 23 Jun 2022 16:47:31 +0000 From: Sean Christopherson To: "Limonciello, Mario" Cc: Grzegorz Jaszczyk , linux-kernel@vger.kernel.org, Dmytro Maluka , Zide Chen , Peter Fang , Tomasz Nowicki , Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Ashish Kalra , Hans de Goede , Sachi King , Arnaldo Carvalho de Melo , David Dunn , Wei Wang , Nicholas Piggin , "open list:KERNEL VIRTUAL MACHINE (KVM)" , "open list:DOCUMENTATION" , "open list:ACPI" , "open list:HIBERNATION (aka Software Suspend, aka swsusp)" , Dominik Behr , Dmitry Torokhov Subject: Re: [PATCH 1/2] x86: notify hypervisor about guest entering s2idle state Message-ID: References: <2201fe5f-5bd8-baaf-aad5-eaaea2f1e20e@amd.com> <88344644-44e1-0089-657a-2e34316ea4b4@amd.com> <7c428b03-261f-78cb-4ce3-5949ac93f028@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c428b03-261f-78cb-4ce3-5949ac93f028@amd.com> X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 22, 2022, Limonciello, Mario wrote: > On 6/22/2022 04:53, Grzegorz Jaszczyk wrote: > > It will be problematic since the abort/restore notification could > > arrive too late and therefore the whole system will go to suspend > > thinking that the guest is in desired s2ilde state. Also in this case > > it would be impossible to prevent races and actually making sure that > > the guest is suspended or not. We already had similar discussion with > > Sean earlier in this thread why the notification have to be send just > > before swait_event_exclusive(s2idle_wait_head, s2idle_state == > > S2IDLE_STATE_WAKE) and that the VMM have to have control over guest > > resumption. > > > > Nevertheless if extending acpi_s2idle_dev_ops is possible, why not > > extend it about the hypervisor_notify() and use it in the same place > > where the hypercall is used in this patch? Do you see any issue with > > that? > > If this needs to be a hypercall and the hypercall needs to go at that > specific time, I wouldn't bother with extending acpi_s2idle_dev_ops. The > whole idea there was that this would be less custom and could follow a spec. It doesn't need to be a hypercall though. PIO and MMIO provide the same "exit to host userspace" behavior, and there is zero reason to get KVM involved since KVM (on x86) doesn't deal with platform scoped power management. I get that squeezing this into the ACPI device model is awkward, but forcing KVM into the picture isn't any better. > TBH - given the strong dependency on being the very last command and this > being all Linux specific (you won't need to do something similar with > Windows) - I think the way you already did it makes the most sense. > It seems to me the ACPI device model doesn't really work well for this > scenario.