Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp805665rdg; Wed, 11 Oct 2023 06:11:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGy7ywrfIJANU1nhj32NMElMrvr+gKj/iIKqOnm+/JMR174KzmDa69YwfOMEBm0TthN5kw+ X-Received: by 2002:a05:6a00:14d4:b0:68e:3fe6:2c82 with SMTP id w20-20020a056a0014d400b0068e3fe62c82mr21546552pfu.34.1697029886997; Wed, 11 Oct 2023 06:11:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697029886; cv=none; d=google.com; s=arc-20160816; b=fNDYEkZLl3yH16Q+m8IkhC2NQrK5cL78FIItVj0gAI/Wbf56jubZW5A79vy/jSqRua 4xmdVtWFaPnk3ook4tm8GPe+RuvHcThYxOWzZQGCGzjPhXzPfGmT4Hn72wpkb6ddVA4S 2fQDGcG6zs/LGSwFvKzcMOPF/aMkJUMHhUcpxTTXSjdiRfUs+ifpBT9F368cTVHGvFKK gJsQnw8h9VRMJM6oTlRwqmk4E04NpMTA0mGptO/4udKMU1A/njm2rm8IYhE12IF2kr1H 6ORniOubrZ6hI3mBmOtWliKJ3/JMOjrrZi6jydKG54AlcpXIL7q97W4Z+q7tz490Gf8Y J4rg== 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=MVrLGdcias+IpH//lUHFub1/fY1kV8L31IPpHVcnmgA=; fh=xDd0Qwl4MrjIQcp9OHZVw4DuXaTa/GWyorukZppqvkQ=; b=EiRMhuL14qiKInQxUDPjjpwUoUpKyUg+RN5fNosKlA8zfCjkhx2fWpSx/B/i0Laovn V8EixID2W5+v7W49NqRhwUULuWOz8N5q6AR9ZPTKsf9oqChNwGnNOgCHDcrTqyD0ydJC 0dXf4byWr9QGCDSnGnE91KugRo02MvuUAx/ps38TJ9wDJ9QZkuPkjgEACrLYvp3X4VfZ eT+ryY56N/huyZNyWv0BzQpJp+55xeGVJbk6zJ3rETc3p4jrm9jYK9/iKWuxwd0h/hZS JBOKoTnXQG7fDeu/q+aaR5jTN6ms3SROOCTQHZHgV92mnnYO5AGdbBJa1McnhmAVSkLe 8k7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="fyS/Nwc9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k4-20020a056a00134400b00690d695b113si12839903pfu.337.2023.10.11.06.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 06:11:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="fyS/Nwc9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 77DAF81142CC; Wed, 11 Oct 2023 06:11:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234985AbjJKNLP (ORCPT + 99 others); Wed, 11 Oct 2023 09:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234942AbjJKNLN (ORCPT ); Wed, 11 Oct 2023 09:11:13 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A858F for ; Wed, 11 Oct 2023 06:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697029871; x=1728565871; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=B53XM39BYMuTT2q7Eh2SVAroSIYenFGSlmbpBE0jnKI=; b=fyS/Nwc9ryfLgeO013yOmFLO/uKiSk5J0C8pOHrxgK6JIqnVLrXjB9oW Z6f9FjqL6zukx25s3JbCxRRSQ3rpJNNndrx3CEZOZnD7FOt63xeGBKqEE ly4xHnU9qZNMqnaXiuVW2wChfdsub/Kb/E2CqL4GWusgGnJzWwdRUI/oM AhoV1nDmDh/qcQ0J7HACBW3BNGQUpkGe5drkTHujxf5pTAGUD9Lc/37db eNx20Y8jYhhwoQB8Ikb4liryryZc+Gzrft2kpEX4s/UuYnJSBAazHY1ob 8jOuyPLacq+JwP9q0Hjjz4fPydfGIeDH4GKUemmWHVRian8iy1yeZDQkD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="383522366" X-IronPort-AV: E=Sophos;i="6.03,216,1694761200"; d="scan'208";a="383522366" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 06:11:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10860"; a="747443328" X-IronPort-AV: E=Sophos;i="6.03,216,1694761200"; d="scan'208";a="747443328" Received: from laptop-dan-intel.ccr.corp.intel.com (HELO box.shutemov.name) ([10.252.56.166]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 06:11:06 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id C1E03109FB5; Wed, 11 Oct 2023 16:11:03 +0300 (+03) Date: Wed, 11 Oct 2023 16:11:03 +0300 From: "Kirill A. Shutemov" To: Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "Rafael J. Wysocki" , Peter Zijlstra , Adrian Hunter , Elena Reshetova , Jun Nakajima , Rick Edgecombe , Tom Lendacky , kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 04/13] x86/kvm: Do not try to disable kvmclock if it was not enabled Message-ID: <20231011131103.6p6l3gpklsaybygy@box.shutemov.name> References: <20231005131402.14611-1-kirill.shutemov@linux.intel.com> <20231005131402.14611-5-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=2.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 11 Oct 2023 06:11:24 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 06:53:27AM -0700, Kuppuswamy Sathyanarayanan wrote: > > > On 10/5/2023 6:13 AM, 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 enumerated or disabled by user > > from kernel command line. > > For the above warning, check for CLOCKSOURCE and CLOCKSOURCE2 > feature is sufficient, right? Do we need to include user/command-line > disable check here? The command line disables kvmclock, even if it is enumerated, so disabling it is not needed. Anyway, I reworked the patch already based on Sean's feedback. No need in taking parameter into account directly now. -- Kiryl Shutsemau / Kirill A. Shutemov