Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1892547lqz; Tue, 2 Apr 2024 00:09:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUGDbXU/q9hGlQRugP4555IYO6CqTk/HHJcW1cWesiDddFZkPYQkXw9urmcPEBT3pXiZXefB0ZUEkroVmCL/Kqh+aTRaKLc596VM4s8BA== X-Google-Smtp-Source: AGHT+IEWsAP0YeIL5QBvkaV81zK9QMDslExbTUwhkP3/Po0/So5CjBDDWMYsoHMpVymSWS86V1kT X-Received: by 2002:a05:620a:40c9:b0:78b:de92:20d3 with SMTP id g9-20020a05620a40c900b0078bde9220d3mr9067332qko.2.1712041779390; Tue, 02 Apr 2024 00:09:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712041779; cv=pass; d=google.com; s=arc-20160816; b=Bo563mOTfhdVgD5Y4ntANQUY95AgIJZ7OzlYEgv9k0WclWw91xhcRjKPtPVImbk1/8 5qn45iIjjRupWM/2kQ6FyQbfETGNNbKxmvjjAVJ+PKUj5YvmGbn6rGXCBm93k93u+nxr aJnb8oiQpqBawk0VVt40Gs2k1HGPpZtUZbM8x8g/aPCK3nmsAJy9ueau52/5XFD2aZDS qg0CTbx2KqdG6WGIwKKZfBxVvP6x+QDlbVdrVlSLcDoqI/zZhyFR6cfoztztJaIJWALQ B378WhrC400Wrh3zEJnVgwSfE3rQqj8une5quWIDJue8cG9EUJs8djRrYkd8eA2NC52R o8dQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=zo45pAXmtGWWoOr8514aPhsu8cHN2dDuxw8U3bP2Q3k=; fh=tt0CEY5xhom/IlvDKU6vi+rzDvhB3cKAIKF4sAkibAI=; b=oJUDlG46qBiJYzXGaLKLblhWLJwZNmJxFD4uJCXDkBGWkj9a0dwgpQHPhTdsD2TLLE U1dCy/LTVCrQbjhk6FrAtP+JxgcFIY5tMaRYc705L2X19fqURUjSVxzSTatc08ZSTtaN 01iZKPYE8qPchh81u2TBp0IAUKlANNiRFC2tBtgF7LvfntV5ubJIa2oG6Sn+hUS7EdFt v8gZxvPKPsUjCe1vp8IOBDQVMlUUfY8kvYoWPJQD0oMZm9gbefNlkZU/z7NnNv/VZ4Rf dolG5cG/280I0bVEf8gb/6pJYKwKzcXtojeXk53T8UBioaA1PaV69JUJbqxHQ6uVaUFs hSyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GaHxsiTK; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-127474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127474-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id j17-20020a37ef11000000b0078d32d3c41fsi153399qkk.417.2024.04.02.00.09.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 00:09:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GaHxsiTK; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-127474-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127474-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 24A141C221CD for ; Tue, 2 Apr 2024 07:09:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E11DE3A1CB; Tue, 2 Apr 2024 07:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GaHxsiTK" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DC512C6B3; Tue, 2 Apr 2024 07:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712041765; cv=none; b=NoRaBb1FzBLmf5pw5ie9OIi/kEbHgUwhJE92qcWdBeA8o6yAeZifpQxOVoK5nYJszbQd0w+DiZtyuMk1HdrUmmPfQpDfa1B++7+Nvfqtxt3hi/bkEOrTClaDzbexkEVx3i3xhDCUPxd4+PwcW2W67EvfGBubjIYUu3U2Rizn+hg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712041765; c=relaxed/simple; bh=cIv6Tl+nzFjXY1TztO8FqRhEBSuJAbM93JA4OC3kQNg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ekXwNW+jMHWqoqQjWU0vZKTfTAmFKDT8XOSuHlJSowHtmXXDymepXRiAdWNaaBb77nCszPD651BDaHBk0XDKsNFn+7DllEeR5uXEKbtoY/HL4hH+AqDBh8L68wBHkXfoDqUaCrQG0lpdC+uJ+vlJbXCEBLZUqwb3eD9nSpzsWyk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GaHxsiTK; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712041763; x=1743577763; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=cIv6Tl+nzFjXY1TztO8FqRhEBSuJAbM93JA4OC3kQNg=; b=GaHxsiTKll8PSozlewdyvCVNSP0XgL7OyOIyuUPkqviM4dwLt9I++cl1 Dn3rHI9BwNQldOBtmtKHG5QgrOib+Iz56ox5MDspswqzk0vaKdzcJB7bP +QmgKzq773CGGyyJ8BbxsrhCK4jWYaKO7Jiv52kuSuO4yPxQITdUHi2Tx vMYqKm4+bjVf/PU70yhT/VZQ94fpXnCKth8bVrhI1xEObWwWTGCKUjUh2 b0qicwQh2wLlViQGsRxGWtCdi+MGJF3W1eGxen/eDtS60vObzUpVIbxM4 1ad0rTwdtCP0nq1oi5vbQllAP44CEXLr2rwXws7/ytiD5CKGKVKRNhP1h A==; X-CSE-ConnectionGUID: TTNmxK9nSI26C4yGrC0pfQ== X-CSE-MsgGUID: XP79r+snSde/fhmXGLPGbQ== X-IronPort-AV: E=McAfee;i="6600,9927,11031"; a="7061621" X-IronPort-AV: E=Sophos;i="6.07,174,1708416000"; d="scan'208";a="7061621" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2024 00:09:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,174,1708416000"; d="scan'208";a="18059189" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2024 00:09:22 -0700 Date: Tue, 2 Apr 2024 00:09:21 -0700 From: Isaku Yamahata To: Chao Gao Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, isaku.yamahata@linux.intel.com Subject: Re: [PATCH v19 094/130] KVM: TDX: Implement methods to inject NMI Message-ID: <20240402070921.GZ2444378@ls.amr.corp.intel.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Mar 29, 2024 at 10:11:05AM +0800, Chao Gao wrote: > >+static void vt_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked) > >+{ > >+ if (is_td_vcpu(vcpu)) > >+ return; > >+ > >+ vmx_set_nmi_mask(vcpu, masked); > >+} > >+ > >+static void vt_enable_nmi_window(struct kvm_vcpu *vcpu) > >+{ > >+ /* Refer the comment in vt_get_nmi_mask(). */ > >+ if (is_td_vcpu(vcpu)) > >+ return; > >+ > >+ vmx_enable_nmi_window(vcpu); > >+} > > The two actually request something to do done for the TD. But we make them nop > as TDX module doesn't support VMM to configure nmi mask and nmi window. Do you > think they are worth a WARN_ON_ONCE()? or adding WARN_ON_ONCE() requires a lot > of code factoring in KVM's NMI injection logics? Because user space can reach those hooks with KVM_SET_VCPU_EVENTS, we shouldn't add WARN_ON_ONCE(). There are two choices. Ignore the request (the current choice) or return error for unsupported request. It's troublesome to allow error for them because we have to fix up the caller up to the user space. The user space may abort on such error without fix. -- Isaku Yamahata