Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1700574lqg; Mon, 4 Mar 2024 00:30:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgrSeeFV/AiKvJ93PBrY5aD3JiJy7Uq0wKbaS3S6OfPBlVb4R6Wtsv3CcacINHW+tIsn84+Otgbki5YawgMMFnIKpU2HNfX8wX7qFP5g== X-Google-Smtp-Source: AGHT+IFlTw7f+qjacAxRhNY/0O1euKFklZ8p0c7w9/WUxvV8zyKmVoQsO+vf/o/y12t77qFSU6hc X-Received: by 2002:a05:622a:130f:b0:42e:f729:a81c with SMTP id v15-20020a05622a130f00b0042ef729a81cmr533310qtk.38.1709541037749; Mon, 04 Mar 2024 00:30:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709541037; cv=pass; d=google.com; s=arc-20160816; b=ruqxxH0+HqSkYoU43CBjzJNXoq0rOco7x3warsdpVAUtpdsuC+XUq5gvq6Y7bvWj/q D/7cYpMI9BSDmT7IRiQcBS0QIUSX85/m2GH69r4HdFio/+q4Nyl7XWhX0URkRdeHXiJa wO0NvoQ1fPagiOv/Diq7UGIJKCQkONysTboO19QGUH4FOAVCRGxNerv3ivwsEGE8u0si c5L8uOzCq2eeW83a9Oi7X2F/rQe08ZesujN1Ekq3vWicuSEt3RzXTiqE5BwbFDCyP7zn BPEVdSHaeKwkBBBXB5e8Sfsn/iB4ZurclfZ9Ewu3e4iF5NvwnifcP9uz3FqWFGAZVjkK fD7A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=835ktKRBfuchh7h+oijxjpI2DgsE6uWFYRvpLNyX7tk=; fh=U+8FBGjAlpcS5c2+8mHmINwqNDlKSy3Q5mS+SnfIv0I=; b=vIT5ygTHNY+6+6NMgL0IVW/T7XPZ9euYz7rP/t0omERUNIUb0gZPQYLc5dREfipSNm Db1BPUmD7yIbusk4y95bwnyHRL1FfSo+vUFEPrko9wUtkmGwZwLEcxZKvGvZ/PB/2hNj a/H77ls+roNQZnDWVh2kmgpSTPweGyfmNnI92TOZkhGwf89wvdWbvE93ADCEwBzcEmIv 7ZAsHzIpvhtocAXfj6NsCkhZJxLC4gFLTdDqRfQeRmAsLEp7qjrDublNzu0fyr23siF2 MEJH2JlMO8Nv6jdkIZe+5USZvST78IkIb57NAwXlRlAjPjQp5tNy41m0gxQsRWdRKa3w g8sA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gOvFZj7L; 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-90204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90204-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 n18-20020a05622a041200b0042eed673e05si2491842qtx.564.2024.03.04.00.30.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 00:30:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90204-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=gOvFZj7L; 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-90204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90204-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 749D11C20E72 for ; Mon, 4 Mar 2024 08:30:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEC6B17C69; Mon, 4 Mar 2024 08:30:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gOvFZj7L" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 8352A17BB6; Mon, 4 Mar 2024 08:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541007; cv=none; b=H38Nq3KuKbcd9/Mm4dbg9aHxTYyagTpZiRbrHSLb/nO3Jt1aZB+uiF0JB4QDkhJSI0gL5v79fmE0x6kTTgr5sluWVXE/azOMiPbJQLCvYeZTPVRgxruEqjM0czEvDDzB5uLc9pAyBFXz/FwFoXL8VNTnzmd8nfi2exUBlzkU3sI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709541007; c=relaxed/simple; bh=YoGW//VtiZf3jZLSkMBfX0sul8AjDFh5eSagI4O10BU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kT8pkJZz9EiOENygRfCO+ydAOy9YDi61ygWs4K8sVh4mmUfeVl5KwxthuUGqYeGQZ2p9YeCJZVJnPRz8E/s9eW4yQiZ4ft77YMRZ6wt3lwgNfMXnjskUgDk9tBt9+kFAsRUs47ryGlgK6lXzorpFsJKwrUEggfJybMO5Oq9lN+M= 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=gOvFZj7L; arc=none smtp.client-ip=198.175.65.10 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=1709541004; x=1741077004; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=YoGW//VtiZf3jZLSkMBfX0sul8AjDFh5eSagI4O10BU=; b=gOvFZj7LfV5DGii6xa02h3NLfnCBDIRgBImYyBGHWpfDGV33i2yma9NR bExm56jwlmOotqFq+e5z+4FnICu4j1g0Gh1ToMNA+VVTD+NJe2M11leWD Qv3AzA8Sf3RiLHMiNYN96Cgjs6R4lE8csV4EQgixU+L9Ejl/1oQAovVnk TKbPV3nj+m1lshJR4oUkrhiJBMCwEOz+YY2jIvCljeSGMByyokCaqsFqR XteHccnoRh2abCM+FrBQF1wKSUJZ4qPCI9TALpv7bhIEsfZjoM12tSkre uHUULos7MYMmeYbuCSa5GtJ3fCTA0iclFeW4DypQ5izwx+jZ90QLCfnYT A==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="21476234" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="21476234" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 00:30:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="13497217" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.125.243.127]) ([10.125.243.127]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 00:30:01 -0800 Message-ID: <858bdeb8-2f83-4a10-8d4c-7e7956d8b0a6@intel.com> Date: Mon, 4 Mar 2024 16:29:59 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 12/21] KVM: x86/tdp_mmu: Sprinkle __must_check Content-Language: en-US To: Paolo Bonzini , 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 References: <20240227232100.478238-1-pbonzini@redhat.com> <20240227232100.478238-13-pbonzini@redhat.com> From: Xiaoyao Li In-Reply-To: <20240227232100.478238-13-pbonzini@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/28/2024 7:20 AM, Paolo Bonzini wrote: > From: Isaku Yamahata > > 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 > Reviewed-by: Binbin Wu > Message-Id: <8f7d5a1b241bf5351eaab828d1a1efe5c17699ca.1705965635.git.isaku.yamahata@intel.com> > Signed-off-by: Paolo Bonzini Reviewed-by: Xiaoyao Li > --- > 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; >