Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3046040rdb; Tue, 6 Feb 2024 05:52:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrNRrEGy2FPFRd/GNoVSCTlEOTnqVvnkTOPDgjJ8wEGcQr/PcvQMPHEIMRFzSSvLX6/M5h X-Received: by 2002:a0c:e412:0:b0:68c:3ad7:4e44 with SMTP id o18-20020a0ce412000000b0068c3ad74e44mr2281556qvl.64.1707227575059; Tue, 06 Feb 2024 05:52:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707227575; cv=pass; d=google.com; s=arc-20160816; b=qM4s4E0noS4RgkgknKv3HFlad0fSm6j14najsLUD3qhL8M2XVpl6R99H0u1y7C5HIi vCoh7yBkgqENESGacfEQKUY3IT/g0/amSfoIYYjsbo4+1ygWewPCFS7HGbViPn0RSrO7 FkvH+WSspBJK5TN56peAyCmmlbCPM81n/15TCnum7JzVBi3NrUKRbXE89PrXH4pdi3fD S6A0f3wAODNy0RLsO29JuwhpcxgEvqaMlz5fiGSOAErXaIMFDo22smDyhcKKUu7hg0la BJufEPPN5esWPyQXx8mg5c9OPrecR5/1evCMNY2PSMDXKfTisPlnCMb2jBy9tAxW7ebA wDWA== 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; bh=BhjC3xrshpM1pp/3JPQnKYITYzrl8RyUIm0LXtIP8hA=; fh=i0mQvUt22Xdv1ZHXt5gUer4m9rjW/6XXOOncVihqOgE=; b=gO8N/v8ANb7F1x2XSdS2xWEAeZtP/5kG8l6GjMf4RGEsslM3Y3HvBf5uOBg0kB+vth Si1/ESc9A6eUWyU/iRSNbYAFrBMwM4PgAGP4hVYOnxjOV3vOiUBM5KPUi9nSMY0KLxd4 RcjMZSDB/AAAC64TcVDwqHPl9qUhzP0H7VTxSSyEQBDJPJ6YrCro95TBRDbNnBZqmyfe 7vjecT6uRzmSng66oXpTxKrD6rWiGWq4tfXpsp4DnxLsXUvSgsaxnRBdujSaz2EY4+eV iRi2ii7oh6cIkO/abVFMBjI7xw5khK5IvPJAO+25HpC9d78XU4cbqT1kdjYSmTj9AiSE LZ8g==; 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-55052-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55052-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU132SicLSOmNjzrw3ORYlEQO/dW0PpbyQTvLo1YrCYvuaqUr/aRLdhiIEKGxRQ3dujLEoEI852z9szWm9JoFqEIXMkH4KNjxZubXRhGw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y14-20020ad4530e000000b0068ca121e300si2359406qvr.253.2024.02.06.05.52.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 05:52:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55052-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=proxmox.com); spf=pass (google.com: domain of linux-kernel+bounces-55052-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55052-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CCD811C23864 for ; Tue, 6 Feb 2024 13:52:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 19737131752; Tue, 6 Feb 2024 13:52:47 +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 2CAAB130ADC; Tue, 6 Feb 2024 13:52:42 +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=1707227566; cv=none; b=LkZ02ZKIpiB/d485ec2G+Qu9oLXO6wvDaUHaZVYMuFmAN9aMDf6K5/GDBYJlLzEeaggt8Ez+HxLx80P5HdHJQixQqnl7aRYVb1g5fW4o/+qDUEStlwdpyMKAJ07YEXI+E0943jPFRV4SDdGPxfnF3ioH4ab16DxRHcdyWAlx6fE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707227566; c=relaxed/simple; bh=Ubkt6qIPEv5fuYSFa69M91opwlIb14lKRpWev/uocBI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iTQ1ndvHu6ryO0PPRrZZHr8mEwcHIrkG4uYw6Oxk7neHY3FDOmY1KZTnmtByDFlf4w6Ee9UF65aB0whgjoAkX4fGw3fxs9kLk8ul2O+Bh39TYMR0uTsfqLsGPw1QD8zoCm9Dm+v/TvYAsbLgIQm6H6Bwp0sZOsNdtTS4A3fueyI= 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 3E8D84481B; Tue, 6 Feb 2024 14:52:35 +0100 (CET) Message-ID: Date: Tue, 6 Feb 2024 14:52:33 +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 v3] KVM: x86/mmu: Retry fault before acquiring mmu_lock if mapping is changing Content-Language: en-US To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yan Zhao , Kai Huang , Yuan Yao , Xu Yilun References: <20240203003518.387220-1-seanjc@google.com> From: Friedrich Weber In-Reply-To: <20240203003518.387220-1-seanjc@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 03/02/2024 01:35, Sean Christopherson wrote: > Retry page faults without acquiring mmu_lock if the resolved gfn is covered > by an active invalidation. Contending for mmu_lock is especially > problematic on preemptible kernels as the mmu_notifier invalidation task > will yield mmu_lock (see rwlock_needbreak()), delay the in-progress > invalidation, and ultimately increase the latency of resolving the page > fault. And in the worst case scenario, yielding will be accompanied by a > remote TLB flush, e.g. if the invalidation covers a large range of memory > and vCPUs are accessing addresses that were already zapped. [...] Can confirm this patch fixes temporary guest hangs in combination with KSM and NUMA balancing I'm seeing [1], which is likely to be the same issue as described in [2]: * On this patch's base-commit 60eedcfc from git.kernel.org/pub/scm/virt/kvm/kvm.git, I can reproduce the hangs (see [1] for reproducer) * With this patch applied on top, I cannot reproduce the hangs anymore. Thanks! [1] https://lore.kernel.org/kvm/832697b9-3652-422d-a019-8c0574a188ac@proxmox.com/ [2] https://bugzilla.kernel.org/show_bug.cgi?id=218259