Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp563671rdh; Wed, 14 Feb 2024 05:25:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWcU29PeOvfMi17U+T2gQb1tYZ2AdJiJpVr4eA/Nk4lCrQ7uxwr4QigJStHMEYfeZGzx7YYTqRWvGoxnhI/lF0BPLMEGlADfcqjncu9+A== X-Google-Smtp-Source: AGHT+IHVXWjHTt53SO5X1keckjcfOocIXX8hFkXc7GsOa2qgxNwJNFBIQTDCzakkojCNr7atprbN X-Received: by 2002:aa7:d9c6:0:b0:560:535:864c with SMTP id v6-20020aa7d9c6000000b005600535864cmr1988448eds.12.1707917110377; Wed, 14 Feb 2024 05:25:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707917110; cv=pass; d=google.com; s=arc-20160816; b=nkvgVDLuFka3McKbFIgywwErTjSLdGfbfxurNkT4Vqvlwny+Hf1VM2YJopBRqE2csk JV1vRskCWt3PAXQ4cPp1F5VUBAtHfUIWD6hgy4ylbwlM+ifMc1L1YMZHAciPfvk7nC5y J1CfmLe0kWX4/dPW4IiYZhFSdJDJBffWY3m81oDjqJk3mml4BUgQnp+bc4y6KTnq3jaq F9Zvrn6q9AfEYA1jqf3L/DteCeY5m37YcKfX6d8sRNrlTI9eNasnXsDSn2m/pQsTflJ0 HuztiC83vcJH+UIUckuPQJmQbm7k8h4EE78GQs6ZAllmJCMvai/TfFv4bTRrYIL+iTc/ 9qsA== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Ef105+Jwx1kDL2pVgb84b96L9sWVBAID/LkC5fr6teM=; fh=2W1hnEFpTlJjoaUn6M6M+2j3forZEjSFAJLlJPvPPTI=; b=Wycm4JjJuwSbzNacED4HId7gUen/R8a/Fxqy8cusCDstTm7DNJq4Bvy2QUw3AXg3+I hI3vKyUiweUclYI1Gv/Ocq6O2qCYbes3RpCmpOOUk+6OnQvdfc2Hs4U4GfP33XcnO6c3 ej6Dbf77+h0JSMvpkswpluA1n56LfVL3R8DFVD9RqCe0V6+ImS+TjGdQur70O/3cahUG O/QRd9TkQqmOTCIuXbtZrSMG/olp1iTEeQSHClwXflYdJM+iZ6ofctu2NJwXVPpa8T6r pSlPggT+EbnOy9lv6vjuq6Tffa4az6Z2JnWedN2KabAb5/p7u3QVQ5DQU38J6ha5/PPF 5oLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=proxmox.com); spf=pass (google.com: domain of linux-kernel+bounces-65275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65275-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCWgEMqAy2nYc1FHvQ32cNxU0aXDBF+F87mjN1dIY33CI3RDHyLXB21qJTI3OvxtiMrbyWwJ4vZXquxbd+O6sxqMHowX1Jz+pCTtDqdksg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w21-20020a056402129500b0055deaaf8b06si4827000edv.346.2024.02.14.05.25.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 05:25:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=proxmox.com); spf=pass (google.com: domain of linux-kernel+bounces-65275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65275-linux.lists.archive=gmail.com@vger.kernel.org" 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 224E81F22445 for ; Wed, 14 Feb 2024 13:25:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BBCC54BCC; Wed, 14 Feb 2024 13:24:46 +0000 (UTC) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 04F7054745; Wed, 14 Feb 2024 13:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=94.136.29.106 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707917085; cv=none; b=haFfAVNY/+LI2EC/fRVQ9FuA7uMrdUg5eQoNkBVryaewAgCMHTxY3JJx8mWeTYqn77XvitPzzLzMq4hBC9mGbFBZ5/PQV9sT1e+1N5ZFl3sKXeuYH18OBavMbiEAaqIaiUb+MhvF8R22W4Ual/KbDg9HgUDWFgn13Ycj+X33XTo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707917085; c=relaxed/simple; bh=FsQPWaH/zjqZ0YupICrU4eLUep9haB5a31ExMi0u37U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GdwHFsUNX3N73rEf6REh2HSgDmH2stEeiKZHffX15SxlpwGuA0ezsqTKDsmyWdZjwJH5b/lVXZNCXB/A65Ui+1MKUwBAf9MkdPKjBrkI3oBtKWT9olQeWFBatqoKVnPd/zGMYhARFaYghab2lhmfXoOQm4VcSjHxIf9AYJv3VyE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com; spf=pass smtp.mailfrom=proxmox.com; arc=none smtp.client-ip=94.136.29.106 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1DFDB48171; Wed, 14 Feb 2024 14:17:22 +0100 (CET) Message-ID: <19ac27b1-1da1-4b31-a0b2-c25574515ac5@proxmox.com> Date: Wed, 14 Feb 2024 14:17:19 +0100 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 v4 0/4] KVM: x86/mmu: Pre-check for mmu_notifier retry To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yan Zhao , Kai Huang , Yuan Yao , Xu Yilun , Yu Zhang , Chao Peng , Fuad Tabba , Michael Roth , Isaku Yamahata , David Matlack References: <20240209222858.396696-1-seanjc@google.com> Content-Language: en-US From: Friedrich Weber In-Reply-To: <20240209222858.396696-1-seanjc@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 09/02/2024 23:28, Sean Christopherson wrote: > Retry page faults without acquiring mmu_lock, and potentially even without > resolving a pfn, if the gfn is covered by an active invalidation. This > avoids resource and lock contention, which can be especially beneficial > for preemptible kernels as KVM can get stuck bouncing mmu_lock between a > vCPU and the invalidation task the vCPU is waiting on to finish. > > v4: > - Pre-check for retry before resolving the pfn, too. [Yan] > - Add a patch to fix a private/shared vs. memslot validity check > priority inversion bug. > - Refactor kvm_faultin_pfn() to clean up the handling of noslot faults. Can confirm that v4 also fixes the temporary guest hangs [1] I'm seeing in combination with KSM and NUMA balancing: * On 60eedcfc, the reproducer [1] triggers temporary hangs * With the four patches applied on top of 60eedcfc, the reproducer does not trigger hangs Thanks a lot for looking into this! [1] https://lore.kernel.org/kvm/832697b9-3652-422d-a019-8c0574a188ac@proxmox.com/