From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796407429; b=sDH6yPYZBGOyrKD65i2ozKgjgaCTYFGrFH/d7c3lTf8JsRttFkYkAkk4aBBhteMKYUNU /lfVhZ1Z+Xp+USjqSlyZNy6Vpcxa2enkilGpXJgLRaK3axV+/+T7k7BtgNVz4lOcX7bJI kpy9yu8f2kSNQ607zx7XMW4AVZIVArtP9emJmOi+QvyQjmg3gNS+cx2NKOnbTM+PH89K1 pBL5lhOnJDUkanKE2yOo9kL+imA6lXnFdIbohua9ow4dSg7+sWEphqBMJB7RFm/8flJ9n QwzBiMgwvuiUeVJZfz85jj90N6xytmuMVBAwDi0KQ/b7L2hewUe9xkZrn1cD6phb6qA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796407429; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Scanned-By; bh=c1UMpb42UVLwL1ZXzDgdGufGAeOJ9cH0l7kjd64fSMw=; b=xqh13QKMfgJSNegBXO+j6W5T2H4dK7CHct/xk0ImTchuWJDna/jJemS8THktSevg7GBN iVTh/ZfNdMfA6mTYCNsr0J3dVZs71B/iY1JWTYjYt24FOVBqy/dso7cPF0olWQmY6Ab5W NrM+2FBl4blgfwA2xFD6zE8odOvgk0pkjU2/Qi1l1z18zE/gyx9otfha8w54/BAz3ZCcS ohWToy+5gETT20WouwFGIJjVNx5vnmhsXiXiZJX5NyEnbXymWTdWlkiiY5Oar6lgTktMv ZLVbvB1rWCsXcG0TzB+Vc2F7jbyAkbr8o4JbxQQMmHkAOkW4vxKD20pzt0yKBLZ5ZKw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cgVDLRBp; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF36A60A381E for ; Fri, 4 Dec 2026 18:03:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AF36A60A381E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cgVDLRBp DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796407428; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c1UMpb42UVLwL1ZXzDgdGufGAeOJ9cH0l7kjd64fSMw=; b=cgVDLRBpfQ8gANicbF7T2XGuUWbndx0nI4ja9lps4peYJ1QiQ3JZQTbFp2cBzRCtLi+/aA Yoc2a+SSAdC636APOPeskjHlt/6zE3ET2WQdB1n8Y8uH5zvzasvahJgvkyZ5STEt6APUvl FrqMc+T0BJvsbeeF669UmgH99KaZB2U= 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 with 8BITMIME (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-_hj4zv0fOD-wmzmfce5aOQ-1; Fri, 4 Dec 2026 18:03:46 +0000 X-MC-Unique: _hj4zv0fOD-wmzmfce5aOQ-1 X-Mimecast-MFC-AGG-ID: _hj4zv0fOD-wmzmfce5aOQ_1796407425 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 2B35D18F52D6; Fri, 4 Dec 2026 18:03:45 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1B72518019CE; Fri, 4 Dec 2026 18:03:43 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Sean Christopherson Subject: [PATCH 6.6.y 03/17] KVM: x86/mmu: Propagate the return from kvm_zap_all_rmap_sptes() out of __rmap_add() Date: Fri, 4 Dec 2026 19:03:23 +0100 Message-ID: <20261204180337.2168031-4-pbonzini@redhat.com> In-Reply-To: <20261204180337.2168031-1-pbonzini@redhat.com> References: <20261204180337.2168031-1-pbonzini@redhat.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 From: Sean Christopherson [ Upstream commit 4e29a0c758a9ef3668f7e52305a6727796ff516b ] When recycling all rmaps, propagate the result of kvm_zap_all_rmap_sptes() out of __rmap_add() instead of unconditionally returning "true", to make it more obvious why a TLB flush is required. Barring a KVM bug elsewhere that corrupts the rmaps (mmu_lock is held for write), it's impossible for kvm_zap_all_rmap_sptes() to return "false". And if rmaps are corrupted, KVM has far bigger problems then potentially leaving behind stale TLB entries. Assuming there are no egregious, fatals bug elsewhere in KVM, no functional change intended. Signed-off-by: Sean Christopherson Link: https://patch.msgid.link/20261113155010.442816-3-seanjc@google.com Signed-off-by: Paolo Bonzini Signed-off-by: Paolo Bonzini --- arch/x86/kvm/mmu/mmu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index df613193ae4c..b79f937dd59e 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -1639,10 +1639,9 @@ static bool __rmap_add(struct kvm *kvm, if (rmap_count > kvm->stat.max_mmu_rmap_size) kvm->stat.max_mmu_rmap_size = rmap_count; - if (rmap_count > RMAP_RECYCLE_THRESHOLD) { - kvm_zap_all_rmap_sptes(kvm, rmap_head); - return true; - } + if (rmap_count > RMAP_RECYCLE_THRESHOLD) + return kvm_zap_all_rmap_sptes(kvm, rmap_head); + return false; } -- 2.56.1