Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp1104548rdb; Fri, 20 Oct 2023 08:32:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYJd4toOvdGVhfpfJHP42MjGGDSgpAZxm43lUE5nvj/Rj0sFU2BzF7xr91DG6bb/C4QjZf X-Received: by 2002:a05:6e02:1ca6:b0:357:43a5:acf8 with SMTP id x6-20020a056e021ca600b0035743a5acf8mr2883798ill.17.1697815941445; Fri, 20 Oct 2023 08:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697815941; cv=none; d=google.com; s=arc-20160816; b=wgiKWHWM8rx7lhlJjIr4cXJ+qJ3bi+gsJFZ+8xmSNFtoPNsgvoM38Bmmr0bViCjmyb Er9GufzBkSMZsEna2rh3ogKLlGpiT8UgZ/LXFfT0+xFB7OWZqLrj3vAtFg3zjY0sR5+a 3eergft+LAYZERxaeSX6yBnpik5Nqa221/WU60IHGimQeaux4ObU8dG2BIZIri47P6Do TaVFvcxP79MxDxDCkjP2AV1tuCY30qkHvDA0eApXkOj6mum+ZnZ3WcbGu6aSmE7J2eNM 9j96dDuKh7KLjXqWZ6rnRY+U5X0rO74BA0kC7p5Z9u40nldRT56Rv1u+QbnqHjt4sWFM VDJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=X28nqJeYL84cwkoy9Ukz+291k+i+3AkqmrCU0I6FmGI=; fh=9ChnFEcPxrnOyqdsYnv7PBdZrDdhQfOoPjTzfv5TE4U=; b=hvQMnFdnBVT++pjcglNCvQ6W2mCVryTEW8U2Bprm/O/G7oPcmVzq9AVPdqbhY+zM/g bH/kOgwXI76bgFQdwe6zWcQEIOD6M4Ovs1zi4msIGqI1vzhFdxBR0uwbeXVD9rrkvtE2 2r3mASPWhmcrytHuNCeEJUNHMOD/7PO7u6wSvTWg0Dbcaa/R+tYqFlQF37r3/UiOHaD/ ldr8dNxzPWCXZnUQ/7uY1hnv1guHMmzK/qI28CrqaHJyaHCxPb3kRkpwFzTZIQlhYgb8 Zonbju2mL26TP1OtOP96vDZWljdAYVFm312jA+dg7Nz4TRjtIqGcjGgVIS8v5T0ZTloJ tSkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ykFAXbjM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f22-20020a633816000000b005780a1eff9dsi2216771pga.54.2023.10.20.08.32.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 08:32:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ykFAXbjM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7BA0283C3F74; Fri, 20 Oct 2023 08:32:16 -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 S1377727AbjJTPcL (ORCPT + 99 others); Fri, 20 Oct 2023 11:32:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377663AbjJTPcJ (ORCPT ); Fri, 20 Oct 2023 11:32:09 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8942AB for ; Fri, 20 Oct 2023 08:32:07 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1c9f973d319so8141475ad.0 for ; Fri, 20 Oct 2023 08:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697815927; x=1698420727; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=X28nqJeYL84cwkoy9Ukz+291k+i+3AkqmrCU0I6FmGI=; b=ykFAXbjMZS77yAZj8Zh2AEY71vF427+ZbPCFcKATpT4l2IxLIOiLSA0YyikIcaVG/6 2aT5kBUkscGxbRL7AS5q3Ybq8FGx1aSMGxVUTfpZqiKQwmoKDNg2V+tyAmjjOxeyGwuo glaGyW3adgFznn90roDFi86uqNi2f872VjFCyjNGrFwl/UXasG1PFtlY28l3gdyziqJH zejH1HTd+q7BqxM9Grw7i22LRveenR2reW+pt4z9bvQqK5VyMWr9B4Xbj8sSWQRwkCCa Vkk5Y80gY+P/jD1gNHVHYOeqc0Rw0QUyIKTq0g8QhkYx9iWI/pPyT5jc8KiWZHdzd04/ sXPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697815927; x=1698420727; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=X28nqJeYL84cwkoy9Ukz+291k+i+3AkqmrCU0I6FmGI=; b=M7v2Os0U2njRU5n7Ua8ReBzlLzAcVYEFSAVelsknCj2V3ccsqg6Y/2+vFqzaF9Ew2K 9RzsJvP13EQtl3mb5FEhK+kB9XM4aNpimQaDuc9J9QMC2/2mRYwEhkROqvhYmyMYeTwf HIkAx/JqEUSZCHhfRBQOgzOvfRDiU7UNC3CwpnGHDt+GI+1oIwoG9Pm5UIMphQmkE6PM 6VX5xk2Pw+PCpOENoUO/Ceno+CR2BjaU+9pSPLZSfoAdi4hGY/aiCfgJHB0DuyH7nQyp QYObho8CoHvL9pCA9e/Yc+QZcr6ndV4PaJuAIfssVlBEQTabklOKadcDigqkwkCiO45E QI2g== X-Gm-Message-State: AOJu0YzDXIcv0BI7Z2Lwnq+vP+3vighoGKu5Htd41E9OmrqvPECxlksc bR9vSEM9B7MTpp1i5xVCx10j4cY8srU= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:e214:b0:1c9:db23:706e with SMTP id u20-20020a170902e21400b001c9db23706emr38706plb.5.1697815926809; Fri, 20 Oct 2023 08:32:06 -0700 (PDT) Date: Fri, 20 Oct 2023 08:32:05 -0700 In-Reply-To: <20231020151242.1814-5-kirill.shutemov@linux.intel.com> Mime-Version: 1.0 References: <20231020151242.1814-1-kirill.shutemov@linux.intel.com> <20231020151242.1814-5-kirill.shutemov@linux.intel.com> Message-ID: Subject: Re: [PATCHv2 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled From: Sean Christopherson To: "Kirill A. Shutemov" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Kuppuswamy Sathyanarayanan , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , Ashish Kalra , Kai Huang , Baoquan He , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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]); Fri, 20 Oct 2023 08:32:16 -0700 (PDT) On Fri, Oct 20, 2023, Kirill A. Shutemov wrote: > kvm_guest_cpu_offline() tries to disable kvmclock regardless if it is > present in the VM. It leads to write to a MSR that doesn't exist on some > configurations, namely in TDX guest: > > unchecked MSR access error: WRMSR to 0x12 (tried to write 0x0000000000000000) > at rIP: 0xffffffff8110687c (kvmclock_disable+0x1c/0x30) > > kvmclock enabling is gated by CLOCKSOURCE and CLOCKSOURCE2 KVM paravirt > features. > > Do not disable kvmclock if it was not enabled. > > Signed-off-by: Kirill A. Shutemov > Fixes: c02027b5742b ("x86/kvm: Disable kvmclock on all CPUs on shutdown") > Cc: Paolo Bonzini > Cc: Wanpeng Li > Cc: Vitaly Kuznetsov > Cc: Sean Christopherson > --- Reviewed-by: Sean Christopherson