Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1585615pxf; Fri, 26 Mar 2021 10:15:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRW3tZH8fQsHvZm6A3zAhVvtXmH8moZ1KrPNrTPihd7xNiZewQww3bDKcp5OIJbTz8aOqS X-Received: by 2002:a05:6402:1c1b:: with SMTP id ck27mr16571535edb.223.1616778955520; Fri, 26 Mar 2021 10:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616778955; cv=none; d=google.com; s=arc-20160816; b=qU5fIuEXBuDim4F5c5v0c3U99o6EZX9AIBY6UJwIpWxIGKoBTU4ipD98Lm7c/cYZQX yNqHLX5Gwe+6kABtTxLeGfVFnsXb+CeaNl5EKFrR6I2GsOaJKhgVYfGuwFXbWNiFLT+W 7ysBF6ISMilT7OQN0nqw3614JDFIzJIBAFjdyHX0FV3gQbG+X0MN00vPBKjUlM+XXi5i dTlA5BcSzcB0hV4d6OSJz0UTJqt/MgO8pNdNKV3XI5m0C2RYe7o/BjK1qtql1SyXx2jL T++ueFcUoejrtE/QFn6thYBmW8TjCIRqwNGO8gbzrLF/oXqvqYgQVqCdgRh5fkfA/X0d ZH4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=JUgswkTFP3CXKJJVd2lPXOooodWvB5w2ER2TbZnPTCQ=; b=fopjcc3HqxDza6OartG17dBfwttN/R2+3PT+4QIHzi8c0lt+xh2wHbGq0mEz4/kffk BetLgFm0viytmuufyCwUDfEVJzu2+BiJydV8ESutnWQ/muQZT9eUQxlEKQszRD7ei2od rMGjQsionwv4D65liL/OADBxViVcsXQ7xmpU7uOfIoNsLTt3jUkxMImny5rWSzn76PCh XwcMDE8LrjvdF0VX8rVV497dtvDB0cMn3p05CVa5XljONPn/6yaNck9cE5saRE1kRw4m LPpFzZBxbV/nE8cX8BZZtT76BugBWykcqE7nJy+Yhi5Zv03gWXkaGf618HM53So/+9Ow M71g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dlZbgFkJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si8079569ede.30.2021.03.26.10.15.32; Fri, 26 Mar 2021 10:15:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dlZbgFkJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230179AbhCZROh (ORCPT + 99 others); Fri, 26 Mar 2021 13:14:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34372 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230243AbhCZROL (ORCPT ); Fri, 26 Mar 2021 13:14:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616778850; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JUgswkTFP3CXKJJVd2lPXOooodWvB5w2ER2TbZnPTCQ=; b=dlZbgFkJeBTxnqrqPcJTD0LmDCfQOLDel6edXXNY5NvM2kSsbBHV/jjOtUrKILQHxWGmG7 voJn7yqh1LtychmG/JLdZBMsAiqdkxbzszSbRrp7tHZkES3Hgmkqqwn6QxHTRBQEJBsiYh kHZm5AhkqTD3MtuwFNzfVBellAmL4ks= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-cMSf6nUDPciEvrGQAPpIbg-1; Fri, 26 Mar 2021 13:14:08 -0400 X-MC-Unique: cMSf6nUDPciEvrGQAPpIbg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D7BCB1084D9D; Fri, 26 Mar 2021 17:14:06 +0000 (UTC) Received: from [10.10.110.35] (unknown [10.10.110.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF46C19727; Fri, 26 Mar 2021 17:14:03 +0000 (UTC) Subject: Re: [PATCH] x86/kvmclock: Stop kvmclocks for hibernate restore To: Vitaly Kuznetsov Cc: pbonzini@redhat.com, seanjc@google.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210311132847.224406-1-lszubowi@redhat.com> <87sg4t7vqy.fsf@vitty.brq.redhat.com> <5048babd-a40b-5a95-9dee-ab13367de6cb@redhat.com> <87mtuqchdu.fsf@vitty.brq.redhat.com> <87h7kyccpu.fsf@vitty.brq.redhat.com> <87eeg2cbm8.fsf@vitty.brq.redhat.com> From: Lenny Szubowicz Message-ID: <6bde62aa-2c57-13bb-0380-93462a51f9cf@redhat.com> Date: Fri, 26 Mar 2021 13:14:03 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <87eeg2cbm8.fsf@vitty.brq.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/26/21 9:01 AM, Vitaly Kuznetsov wrote: > Vitaly Kuznetsov writes: > > .. > >> (this is with your v2 included). There's nothing about CPU0 for >> e.g. async PF + timestamps are really interesting. Seems we have issues >> to fix) I'm playing with it right now. > > What if we do the following (instead of your patch): > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index 78bb0fae3982..c32392d6329d 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -598,17 +599,21 @@ static void kvm_guest_cpu_offline(void) > > static int kvm_cpu_online(unsigned int cpu) > { > - local_irq_disable(); > + unsigned long flags; > + > + local_irq_save(flags); > kvm_guest_cpu_init(); > - local_irq_enable(); > + local_irq_restore(flags); > return 0; > } > > static int kvm_cpu_down_prepare(unsigned int cpu) > { > - local_irq_disable(); > + unsigned long flags; > + > + local_irq_save(flags); > kvm_guest_cpu_offline(); > - local_irq_enable(); > + local_irq_restore(flags); > return 0; > } > #endif > @@ -639,6 +644,23 @@ static void kvm_flush_tlb_others(const struct cpumask *cpumask, > native_flush_tlb_others(flushmask, info); > } > > +static int kvm_suspend(void) > +{ > + kvm_guest_cpu_offline(); > + > + return 0; > +} > + > +static void kvm_resume(void) > +{ > + kvm_cpu_online(raw_smp_processor_id()); > +} > + > +static struct syscore_ops kvm_syscore_ops = { > + .suspend = kvm_suspend, > + .resume = kvm_resume, > +}; > + > static void __init kvm_guest_init(void) > { > int i; > @@ -681,6 +703,8 @@ static void __init kvm_guest_init(void) > kvm_guest_cpu_init(); > #endif > > + register_syscore_ops(&kvm_syscore_ops); > + > /* > * Hard lockup detection is enabled by default. Disable it, as guests > * can get false positives too easily, for example if the host is > Yes, I do like using register_syscore_ops for this. I will base my V3 on this. -Lenny.