Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1612252rdb; Tue, 20 Feb 2024 01:16:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVqf5noOXjG1Q4lG+rh96Uc/QF54GGVrf6WOHDS49c3XyRUkcNLcWjZjwmFrZEg+DOB+qFS1GLBjCL6HkkvIvjN/NMHzjsr2S9Kx3AJ8g== X-Google-Smtp-Source: AGHT+IGld3FJ2KkmjJvNIa9mtX4/j7VFp8WgS4G2sk1kqoQz/dfeYHBBX3cRAMGHH2Z8fdk5dRwY X-Received: by 2002:a17:90b:8d1:b0:299:5160:daf3 with SMTP id ds17-20020a17090b08d100b002995160daf3mr6572580pjb.12.1708420584285; Tue, 20 Feb 2024 01:16:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708420584; cv=pass; d=google.com; s=arc-20160816; b=c7qDIFrrxyX8oFYHGvLVW5GhvTD54kcCiRemH9ahox729ytQMlTDi1uZ6YTMcDlWyB n50TQQ3/C4SyVob6v3mkDKvgvUVO83oA4X2ix5eESdm4+2ACRC1ZIfKh7XJLhhxacdmY Ih7xn8a1Gzr80F1+azr8WpvUJ+g+wDiVCdGjOI0oHimhWP46EV9XcXCK7oprQ5quPQua yXbBsqKir5iZdpjUHKGIpIxXQBzsFWlRaVsUSQkqOm5D96LuWLlIT+UiZJqwXkaqdRjJ 3UmTQ3xyOxU5vbGGhtLTn4pbBIkM/MQWhpfPV5bu8sLp4xDT5zznoN6VcDqDo8c7FTi/ HG5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :from:dkim-signature; bh=ig5UbaNkYqer64gSBn+qlNSGWqY7ObrqlHVCVer7Hj0=; fh=SrUQdrrhJgQcAljKS2BtEgcfPM0qP2ikiB/ElFHnX/Y=; b=rN23HAebGdY9Fk/+ep0IfMLvx4znWGeRFRobAJvAedeApk4xLp72npzPnqAEOq/TOi q1RuvTDjpT7aO88t1sSoHvcaC90VDzMgLfRMOTQ7yPsFlidN55eT1c6wEQKIikiPuohx GZZntd6dkBdQfZ71pn14kuSmp4z6KtIa7BWAG2aI6KfKuOiS1uHfesMCm+zvppy+Fz02 6/Yn41erX4xeNUbCotvkEbb9kycShbkYC0L2clSBlVNSpDcU06CpAH2TpcctJ+Hcd9um whQ3HKFbC5bIVBgeAlTW2Aaf/sMX/eqQlOoSmTQZbuwSZH0VSJJMf1p0XNs6iOWW4UsH q50g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nCl+nh95; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-72647-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id mf11-20020a17090b184b00b002992bae6439si6155264pjb.0.2024.02.20.01.16.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 01:16:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72647-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nCl+nh95; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-72647-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5552828BEFC for ; Tue, 20 Feb 2024 09:06:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A56B5EE8B; Tue, 20 Feb 2024 09:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nCl+nh95" Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B11F85BAC7; Tue, 20 Feb 2024 09:05:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708419935; cv=none; b=ePLrS7waLHcz823F59sJsEWgOTJ6bjgsi1M1c/bVzTWVHHnjHpGTOAYq+pCgsGP4RTJsHUN1qFCRvM0j18gcwi7bcdORtqsavCP/ivIiPIBqVN3ulX+NI2TgRdsMf+XWiw1MMDsiWPeFU8ZXq12adJs3c7HuoTz7qOe4Xj0gS5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708419935; c=relaxed/simple; bh=jK3b9DLJc9Th42/uIfgM88dYSGXRde4vwZMJjZeqWns=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=JFSQidP5ulHTH/D40DPBBmBAD8WKpj5xoMRB+P/Bo7szgXTGdOZYFI7Ngbd0cI2jNjrZQnUmrX6raHmyUzCQNFbGIKHuCYE0MmtazZox9LQ/I0YwnR4DsgHAsGCnF4DJeSFwia1/cv8mmDVD5LZa2A+XCbc0eN2vgecoVEBEo/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nCl+nh95; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4126aee00b2so8852045e9.3; Tue, 20 Feb 2024 01:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708419932; x=1709024732; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=ig5UbaNkYqer64gSBn+qlNSGWqY7ObrqlHVCVer7Hj0=; b=nCl+nh95l2xfjO66LiC+sEZsJ9ZwGj//3iDT6ouLO+Kt1KfUJtIQ06jiC58781n4k+ YeyB+RqZ1j2K5ilvxQL8Divzd0pPRJet8iu7tjtPWUguqhpkiRMeEjab3O15+XuwyPET Ttff8GOAR3A7jtzlEmC3COdY6Kq1IZ62NusEu1r0STuqJIV+2KUwoa4tVIUeQnul5PAl R0/9bkYBBLw7/VHNluYBPwUo78MfTde4Gucnkiid8kHAnkQsjwlFYeAuwpyWDI+YVwOR BeU5a46qq9fYIdXkDTLF+87IeSlWS0qyd+CVg2uZa1irPWY6zgNINF8W22ygLDEXVsXn bmMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708419932; x=1709024732; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ig5UbaNkYqer64gSBn+qlNSGWqY7ObrqlHVCVer7Hj0=; b=joWR9u4WFQ0Mk0h9NROzcQzLwNAKS0JR7GTZOJolk/EaYqOp7q5fHqX4ALmCBI7sCC RvmZAV3H5Ef/E/x2mfMXIUyNG29BoU789O+Jfi9pPLlASX22cEiH65lKML9Z7Pl3JGil nfixuzhN2qFw8mjXlkFOGEv0V/XDiJcsXy1eRhnHIozNPZPMHExqGEfgzB8pgtEopGAf ZoGeOqV/1hiMjSsGHATlhSAAreLUnyt7ovJmLXUsROeqpTeH4ZghIWo812wXDOdaTOZ2 YuatGU9fwjngWLx50/arKUxcsBmGTWKiU52m/YbmgsottPfiZg4Dj+lKfszLDNzC9xmT wmww== X-Forwarded-Encrypted: i=1; AJvYcCWKixPwoY/TZyl6s3dVO3AToFC8YmJ33KmuMNFvOGW38tvc+yadXS5yNE2LX5oPxLNwRfJkBSxpmdXpL23IwqmPxvuA5bMyV5FbNsnoDrixI6vrtYhVcIsxMpMkWUnOq8VA84bwPf2ixRnly473osjQW5sXXpsJzWBF9z3zWYAhIutZJYFdcqzqL38WDeF11bHU96kDMZP1rnhDM34qSzp9Ou9rC4sri7TZ5UvOb3dzg5goJXiopimYfA== X-Gm-Message-State: AOJu0Yx3Vgnm0FRxK/nxVPcciojR4yY+pNu6QA2yK1gUQLV7YO0DHUAO K08xHcN8OGeT9k9QBhv/JYZKmb+m6qc7YDns6vA/4c7JJUdo5AFd X-Received: by 2002:a05:600c:4f0d:b0:412:107d:cd6c with SMTP id l13-20020a05600c4f0d00b00412107dcd6cmr10595323wmq.28.1708419931996; Tue, 20 Feb 2024 01:05:31 -0800 (PST) Received: from [10.24.67.19] ([15.248.2.27]) by smtp.gmail.com with ESMTPSA id l20-20020a1c7914000000b00412706c3ddasm570024wme.18.2024.02.20.01.05.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Feb 2024 01:05:31 -0800 (PST) From: Paul Durrant X-Google-Original-From: Paul Durrant Message-ID: <54ef40fc-31dd-4d37-8091-66a1ff3df6b9@xen.org> Date: Tue, 20 Feb 2024 09:05:29 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: paul@xen.org Subject: Re: [PATCH v13 18/21] KVM: x86/xen: don't block on pfncache locks in kvm_xen_set_evtchn_fast() Content-Language: en-US To: Sean Christopherson Cc: Paolo Bonzini , Jonathan Corbet , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Woodhouse , Shuah Khan , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20240215152916.1158-1-paul@xen.org> <20240215152916.1158-19-paul@xen.org> Organization: Xen Project In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 19/02/2024 22:04, Sean Christopherson wrote: > On Thu, Feb 15, 2024, Paul Durrant wrote: >> From: Paul Durrant >> >> As described in [1] compiling with CONFIG_PROVE_RAW_LOCK_NESTING shows that >> kvm_xen_set_evtchn_fast() is blocking on pfncache locks in IRQ context. >> There is only actually blocking with PREEMPT_RT because the locks will >> turned into mutexes. There is no 'raw' version of rwlock_t that can be used >> to avoid that, so use read_trylock() and treat failure to lock the same as >> an invalid cache. >> >> [1] https://lore.kernel.org/lkml/99771ef3a4966a01fefd3adbb2ba9c3a75f97cf2.camel@infradead.org/T/#mbd06e5a04534ce9c0ee94bd8f1e8d942b2d45bd6 >> >> Signed-off-by: Paul Durrant >> Reviewed-by: David Woodhouse >> --- >> Cc: Sean Christopherson >> Cc: Paolo Bonzini >> Cc: Thomas Gleixner >> Cc: Ingo Molnar >> Cc: Borislav Petkov >> Cc: Dave Hansen >> Cc: "H. Peter Anvin" >> Cc: David Woodhouse >> Cc: x86@kernel.org >> >> v13: >> - Patch title change. >> >> v11: >> - Amended the commit comment. >> >> v10: >> - New in this version. >> --- >> arch/x86/kvm/xen.c | 30 ++++++++++++++++++++---------- >> 1 file changed, 20 insertions(+), 10 deletions(-) >> >> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c >> index 59073642c078..8650141b266e 100644 >> --- a/arch/x86/kvm/xen.c >> +++ b/arch/x86/kvm/xen.c >> @@ -1678,10 +1678,13 @@ static int set_shinfo_evtchn_pending(struct kvm_vcpu *vcpu, u32 port) >> unsigned long flags; >> int rc = -EWOULDBLOCK; >> >> - read_lock_irqsave(&gpc->lock, flags); >> - if (!kvm_gpc_check(gpc, PAGE_SIZE)) >> + local_irq_save(flags); >> + if (!read_trylock(&gpc->lock)) >> goto out; > > I am not comfortable applying this patch. As shown by the need for the next patch > to optimize unrelated invalidations, switching to read_trylock() is more subtle > than it seems at first glance. Specifically, there are no fairness guarantees. > > I am not dead set against this change, but I don't want to put my SoB on what I > consider to be a hack. > > I've zero objections if you can convince Paolo to take this directly, i.e. this > isn't a NAK. I just don't want to take it through my tree. Ok. I'll drop this from v14 then. It can go separately, assuming there is no move to add the raw lock which would negate it.