Message ID | 20240227232100.478238-13-pbonzini@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84199-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3038347dyb; Tue, 27 Feb 2024 16:02:30 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXda87xwJdoqaIXbDoyqm5zt6Ec9LJin80Pf44BUNNUQop5o10czOWn3CMJ28yqsgyj1Ri/kHCLlI5oQ0+vgMLyH84wmw== X-Google-Smtp-Source: AGHT+IFcKzmY8CSUSv2NP9jd6ychMEtF7Pj3DBiXAZivyWQHMDrjvLnKhlHdRLMMA++U8VZ6EqeJ X-Received: by 2002:a05:6a20:ac44:b0:1a1:1571:84d8 with SMTP id dh4-20020a056a20ac4400b001a1157184d8mr2005511pzb.47.1709078550388; Tue, 27 Feb 2024 16:02:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709078550; cv=pass; d=google.com; s=arc-20160816; b=o2Wp5A/wbvLes82sCrxDAzL2myL3aK8Jak5dLydWOXAZp7rvDzXIXWA7kn8+aUlCGH AF1s5/owu4KMHVKcHgedt2AkLIhk0HwV/lzRILchOiBJyvhL4VnOU/91oqpEubCyL0oS HqkmnGMhQB2d8yC0x/wlqNA3rWlBUXeeAwIUyh+QwqsnoZnHJtFhfMYAHWgn7/PAe3xa PzCrD/JRHM3Zdx0h3/oZn0O3cESFkar+yOsZaOyK/Y3CXsFEDtL6i3m/SVThgXFch0Dy 9aRaTzgFBWBT5CTYzhfGhPJFesK2bJmaKDRlDXKwbffqoaU93XxTq8L86Ze6mXabRu/W uI4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xHtW+SDyafl3r8UhKOO4YD7Evd7+sKdfgmUWfdfwcR8=; fh=w959IHqhc127FWPV0cXk2/OILEGJjMRkHPBcqMZlvxE=; b=t0eFMG3Uc6R/lQLgP5s4O4a2Sn9ZAmTdTUIN5Jdvp4hkC8L3KjDNY5tAQU4RThVTAs FsyNWVbHxOpEfviqD8BebynMz4R4WtgTeM+cZLhPmIvkyQhvC2lNOjiEOC9FhHBhVOym Hb3yRUICJX5nzeS4sBlvrQq3O6oI8BZXoS+fVbtkEcqM3Xb4ltMnwMew1Xjw4BBYdgCZ 2I3sNJWktL2RtS7i+1UyQtYWm2tnigWeVFOcjV93wVZCG0lvdrCBvWanlEVYkm2+QAQh cUz5j3qTXArhR2eUh8yVbRVR01bFpSZJwAvXF2o9zixMdsahvwCjev1pyPTh6r6ZXh9o LItg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iN2los5C; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-84199-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84199-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y21-20020a63e255000000b005dc8f60cdf9si6219205pgj.302.2024.02.27.16.02.29 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 16:02:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84199-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iN2los5C; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-84199-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84199-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BB79CB3096E for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 23:27:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D35DD5F476; Tue, 27 Feb 2024 23:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iN2los5C" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 A0F155733B for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 23:21:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709076071; cv=none; b=ZiB1RAO4P0kEVeojNem5wqvA/x0IZs/IhshL6driR3HdAasC8zJ1oCNRrCxC+YwpRkI5RqRuHUxqode19EFpwfCBPxUsxNLXsxTskX9R1wJLehPHsiKkKAJqbjoX326PPWIUxe/8i4crjm4faaYXtStngigp6D1ON5mopMXHMxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709076071; c=relaxed/simple; bh=pLtVn59cyQbuntetXuEM2l8HbE1V0ERcTrZHvrurl3A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=idh1tfXTR5djZ+nlebpC/WKG7F+BEiz9Zt+VuOihF6UxTzCgF0QhkvGD1FZCt6k5cqJgnliT3ZC8oZu1Z42tGaA/jwlByknVYjnaB8TWQwWsmMoqyUZgAGeLy8fXX4pZpagG2aEAhXPPhFtIsMvARvSityoHLweZfD/HteDeeXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iN2los5C; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709076067; 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=xHtW+SDyafl3r8UhKOO4YD7Evd7+sKdfgmUWfdfwcR8=; b=iN2los5CNVfCtWK9lkPo96SSE/PN7vWDsAFgQOrC6t7bSi8uoOnn3lzPgDrLlGWtPGwYQx kku5aWWEQLEkHzPBfUttGA8iqvpktL4FFX7ACeI906pPvs6HgQBsXIFY931jJzY5CxLrbs gWkOrB2+KczVpaEKI3XO0ucNkC7iilI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-sk8ZdshlM7qS416hg-28uQ-1; Tue, 27 Feb 2024 18:21:04 -0500 X-MC-Unique: sk8ZdshlM7qS416hg-28uQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD6F8845E61; Tue, 27 Feb 2024 23:21:03 +0000 (UTC) Received: from virtlab511.virt.lab.eng.bos.redhat.com (virtlab511.virt.lab.eng.bos.redhat.com [10.19.152.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C45BC040F7; Tue, 27 Feb 2024 23:21:03 +0000 (UTC) From: Paolo Bonzini <pbonzini@redhat.com> To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: seanjc@google.com, michael.roth@amd.com, isaku.yamahata@intel.com, thomas.lendacky@amd.com, Binbin Wu <binbin.wu@linux.intel.com> Subject: [PATCH 12/21] KVM: x86/tdp_mmu: Sprinkle __must_check Date: Tue, 27 Feb 2024 18:20:51 -0500 Message-Id: <20240227232100.478238-13-pbonzini@redhat.com> In-Reply-To: <20240227232100.478238-1-pbonzini@redhat.com> References: <20240227232100.478238-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792098749992830531 X-GMAIL-MSGID: 1792098749992830531 |
Series |
TDX/SNP part 1 of n, for 6.9
|
|
Commit Message
Paolo Bonzini
Feb. 27, 2024, 11:20 p.m. UTC
From: Isaku Yamahata <isaku.yamahata@intel.com> TDP MMU allows tdp_mmu_set_spte_atomic() and tdp_mmu_zap_spte_atomic() to return -EBUSY or -EAGAIN error. The caller must check the return value and retry. Add __must_check to ensure that it does so. Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com> Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- arch/x86/kvm/mmu/tdp_mmu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Comments
On 2/28/2024 7:20 AM, Paolo Bonzini wrote: > From: Isaku Yamahata <isaku.yamahata@intel.com> > > TDP MMU allows tdp_mmu_set_spte_atomic() and tdp_mmu_zap_spte_atomic() to > return -EBUSY or -EAGAIN error. The caller must check the return value and > retry. Add __must_check to ensure that it does so. > > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> > Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com> > Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> > --- > arch/x86/kvm/mmu/tdp_mmu.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > index 55b5e3857e98..3627744fcab6 100644 > --- a/arch/x86/kvm/mmu/tdp_mmu.c > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > @@ -539,9 +539,9 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, > * no side-effects other than setting iter->old_spte to the last > * known value of the spte. > */ > -static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm, > - struct tdp_iter *iter, > - u64 new_spte) > +static inline int __must_check tdp_mmu_set_spte_atomic(struct kvm *kvm, > + struct tdp_iter *iter, > + u64 new_spte) > { > u64 *sptep = rcu_dereference(iter->sptep); > > @@ -571,8 +571,8 @@ static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm, > return 0; > } > > -static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm, > - struct tdp_iter *iter) > +static inline int __must_check tdp_mmu_zap_spte_atomic(struct kvm *kvm, > + struct tdp_iter *iter) > { > int ret; >
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 55b5e3857e98..3627744fcab6 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -539,9 +539,9 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, * no side-effects other than setting iter->old_spte to the last * known value of the spte. */ -static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm, - struct tdp_iter *iter, - u64 new_spte) +static inline int __must_check tdp_mmu_set_spte_atomic(struct kvm *kvm, + struct tdp_iter *iter, + u64 new_spte) { u64 *sptep = rcu_dereference(iter->sptep); @@ -571,8 +571,8 @@ static inline int tdp_mmu_set_spte_atomic(struct kvm *kvm, return 0; } -static inline int tdp_mmu_zap_spte_atomic(struct kvm *kvm, - struct tdp_iter *iter) +static inline int __must_check tdp_mmu_zap_spte_atomic(struct kvm *kvm, + struct tdp_iter *iter) { int ret;