Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp193357lqp; Tue, 11 Jun 2024 01:12:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUQW+5yvDgyvyPdSNW28ngae1zDYozJZiz7na/K+kOX5uvlqX1L1satT/GV9fJlg5i0DJ09/EnHpJVKgJGqR4tuXSU+L5DdfaBNhQs4iA== X-Google-Smtp-Source: AGHT+IGOajPt2WvIwUBrh2l7HLiAiaah4YgP/FwYVLc6LYoM8sRejzJcHtM3wz2+/qQS3PZelpGK X-Received: by 2002:a17:906:258b:b0:a6e:f915:c8e1 with SMTP id a640c23a62f3a-a6ef915cb11mr524994866b.21.1718093520023; Tue, 11 Jun 2024 01:12:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718093520; cv=pass; d=google.com; s=arc-20160816; b=b60vZXP5aU/1zmc9tepPvve7oaiGGmlwjx2Kj/VmddksjvHlp6RgqI39v9cJH4bHV+ B1vHlCN+kTUk6CxbsQGppLzg/EdT+Dh8W5FdTW+mND9DJaK6JkPcWvSTN0ycMy9+1Waa 4ZMOY/8FWlNjEV5hoYt7eC9nFnIm/ivA2Gq2ZwPVHaSU45XIvGvVYFN1n9xQ8sZfsCGd MG4UNpwuWCdVPvfFFWJD0IhKFDacVzKOmDpW6VPDyf+dEqL53XldTxqVrkWQZMtEEZW3 d/Ep/XH0e5o76xKspuJgAKFWwSXDmIrejoaaEGEtU1mPPelGUTCzU39YA0gb0pxDvqyU BmIQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=iEiFPKaZxInySow1QYHYIL0tSIhJVYnSxikl/zI1x4E=; fh=xh4+9tPKGG7kert7QlHKNiaEPmBLrgTzZKZD1BI7xxY=; b=yDrngIp3nOqMzIh2jO+6uYwy3Qkuubojo6ox1betDov6+5+p4p6JOfraPbajpgb0en BbaRhLZgMzvqq/oV0eQwJeSkF/YflN/19DFss9A9SiPIdBVo/jeTtO0shUlnOd9174e7 Nnfpe93aSl23+KFLaMDWaNhGE6XQpGK8Z4hBRuclpyrqeXhutJxFwscVloDDX+uu9kVj HW/tQ8Zr5YZ9+1AGVTo7qN20sn3VjGF1+Rr/1LxRYLRL9+yVxR2tzhIcW82K9zyKzcp0 0iZXWDnDIrZ8FxXmFuShXFPj1u9zizWH+WdQNwVEoQfGh/OAUR/8Jo+bhnVFvQYTwfYg Qu1g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dpDLmDmb; 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-209450-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209450-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f0ccde515si302385466b.137.2024.06.11.01.11.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:12:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209450-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dpDLmDmb; 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-209450-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209450-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id BB2E51F24EE5 for ; Tue, 11 Jun 2024 08:11:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B87AE174EED; Tue, 11 Jun 2024 08:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dpDLmDmb" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 70C7617334D for ; Tue, 11 Jun 2024 08:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718093493; cv=none; b=AlCgyWT4BoUB/C2Zq6qkw5fam29HK6U2lIlxwpOsRbGUaHyJr1JuDfDMbm1sjD6geCFpyUWXMr2uwjIhaEqx8IdqSB/va+xu25+x/YQaeavsVEgdKw9POhhc0UfyoPLImM1oXqDeP3v8Fb0JFujfTdMANPWrPA/jzqDtqB9/Q3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718093493; c=relaxed/simple; bh=HTNYOw+/f2aa3QtL2Ogl8hMTizcliwOty28Tv1VGdhw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=bqKb0BV0R9YVFlv6AioU20svqeUIVsaO4XxDguQrsc0kXN8P2Wz5trhVM7eJiQmr3OsSF229JiaX3RuzXuWy9WHUdI+tmUfzi+TVGCCqWY2+PtkcAC/NrD4QndU9+dJiSmP6LIoHCyJoFWpoISrlHdpTc4mH7CCEL1E6BC4J59s= 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=dpDLmDmb; arc=none smtp.client-ip=170.10.133.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=1718093490; 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; bh=iEiFPKaZxInySow1QYHYIL0tSIhJVYnSxikl/zI1x4E=; b=dpDLmDmbehTChw2lbjHBJ4pj8upePo6QRXUTqM3dPVcPrkjeh+zpdfEHFY325RmPmpzRjY N0GMyBwwFlhENZct4tKhyOtROSPTGToPn9X9vuPfBpDNV2u2+tCzGRKCK2NMcDHB3PBHOQ pN/Pn4X19Zv9AbM99vvsccHf1lgJt7c= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-VxUfIvIzPdqjXdF5JSPN0g-1; Tue, 11 Jun 2024 04:11:26 -0400 X-MC-Unique: VxUfIvIzPdqjXdF5JSPN0g-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 847F3195608E; Tue, 11 Jun 2024 08:11:25 +0000 (UTC) Received: from virtlab1023.lab.eng.rdu2.redhat.com (virtlab1023.lab.eng.rdu2.redhat.com [10.8.1.187]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C295619560AB; Tue, 11 Jun 2024 08:11:24 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Isaku Yamahata , Binbin Wu Subject: [PATCH] KVM: x86/tdp_mmu: Sprinkle __must_check Date: Tue, 11 Jun 2024 04:11:23 -0400 Message-ID: <20240611081124.18170-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 From: Isaku Yamahata The TDP MMU function __tdp_mmu_set_spte_atomic uses a cmpxchg64 to replace the SPTE value and returns -EBUSY on failure. The caller must check the return value and retry. Add __must_check to it, as well as to two more functions that forward the return value of __tdp_mmu_set_spte_atomic to their caller. Signed-off-by: Isaku Yamahata Reviewed-by: Binbin Wu Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com> Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu/tdp_mmu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c index 36539c1b36cd..effb70f7dcba 100644 --- a/arch/x86/kvm/mmu/tdp_mmu.c +++ b/arch/x86/kvm/mmu/tdp_mmu.c @@ -530,7 +530,8 @@ static void handle_changed_spte(struct kvm *kvm, int as_id, gfn_t gfn, kvm_set_pfn_accessed(spte_to_pfn(old_spte)); } -static inline int __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, u64 new_spte) +static inline int __must_check __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, + u64 new_spte) { u64 *sptep = rcu_dereference(iter->sptep); @@ -572,9 +573,9 @@ static inline int __tdp_mmu_set_spte_atomic(struct tdp_iter *iter, u64 new_spte) * 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) { int ret; @@ -590,8 +591,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; -- 2.43.0