From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 871CC43712E for ; Fri, 10 Jul 2026 16:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783701551; cv=none; b=FU7YGzaEuMuDqC1WkQ7hYNIId9g4GmTPwzZc6Apvl4x0EFW+U6crjGDCP2JGShPIMpLwvRkvB0RE9NykH6dRyPzfWIzvrgSpdortZ/PtsYyv1gwGdjIccvx+JGtWD831TC813zljr4b4MU+7kt7poHHtdP6FWNy2p3rwNjXj9nI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783701551; c=relaxed/simple; bh=PXWpFGDjo49ebvD3J1EZhbbcBn9lhFalPM090sNNP24=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VE4zDH0bGnueIpFYsS6Cb/VMHojx0pJ9uKWQMJVx8NOdzN9aVTjWHOIP8ApBWn1rHeY9GeopdL+QZlAmn4blv9VY6AsGAp2IcfdaNcQYU9a26DTfdPMQ0taYdlSLjwrXqDVh/lc1u7UX0MWiM07n9n45nhbmhWVXSwEgnpyxPhQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=V44Ncneu; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="V44Ncneu" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-92e6a434cabso57103485a.1 for ; Fri, 10 Jul 2026 09:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783701549; x=1784306349; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Pz9Az2A5A+eQsiowkEP3oUH5xkba/HyvmJjmLQ4f6yE=; b=V44NcneuBmSKEBchN78CSp+SaMfBLy1//YCpr9I1tT1XRDcFXG5+tSyEJHEeaYeVfz NIrEue9qNfNKDSL2SyQc22uCFfZIccdEKlzTvZiVjxSs7yW8ymKPTbjh3h5fCx8J6VRE ruw7a7Zb4wsfuusky6aj8N5Zh51FpvSSoGJh81s9qefwupZ1P5l5cIhrHg0UWBRhHCZF uNQncP6VKhKSu8y8EbYfIk2ibfq5mUb/raxQxKixeDH/8G6mZA13O+UEHcgJY563IsTS 5NsI1Y3ojGWLdbyGmeRkfxWy2e+I5uI8lgN5cqIFUUap3X2wvZlttOnhG3/sjVeBLu5G WuaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783701549; x=1784306349; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Pz9Az2A5A+eQsiowkEP3oUH5xkba/HyvmJjmLQ4f6yE=; b=PmmxqLgPqAvTMRKZPXA/50zjawUfsI3jjQ7usMd1N2xR7IUfyUuyG863G9DdEyuX7r o48OKeWcjC48xUQlOiQbe/J7W/ChHT+QEvTGUYQaNgt8ND9eQQAIa4igAgqiScae8Lov ihAQyPoN8jjSwenRFhl73f4gU/SgAYkJwIILo7CFQkQ+qZeVCVYxJ8AumNuK+DC1z0eL xHQb92PSeDHWkTShL9/3j1HaqIEeffQASPzh83XPN3IbE9XWRNQZfGnuRWcO50GK8SoR tvLf7KsqcmT++L92FK5fV9sPVkDrJmDvWGHRyypZDuLfDVr9755WpHfwqq6P6EveAqMU 4QvA== X-Forwarded-Encrypted: i=1; AHgh+RrKu7ityrIhh/NZeVtyC5Ome7Jw6/JeRYmsQSizwgBWkT4gC2dSOkRUgex5HPjKwO3X/uqwr95W5wbvx+k=@vger.kernel.org X-Gm-Message-State: AOJu0YxT2HeCdZ55DC2SDaw4T7+Q05YUFYx6x0j5Jzi8q4kqHRG9HmwN nIesoiH22EkZA+BP1TSevf8AcJvJXhL8Qa+ZXVV0VWcN3DTr3yxvyKKRzjGnAUjGLys= X-Gm-Gg: AfdE7cnrMG+o0PgbgSXcHKQG+r/3V6A2/ulBFYJuuf06ihJXolreKf8/pwqLn64xFNg XBAAqkaB0sWjQ35ZUoyO48mPwiMVJrlq3yEoO4I71ZtVjS+KzyTxNbiK6TZb5pyJ3lsqqmIVJy0 FvCtX1N2167a/h97BBVzjPVCrNl6SeSr0uvyLlh/5geBpqmEkd4WVBrKg9tfDc+VF+A9n1Nh787 LY8reV3i5/NPR0zfa6Rc2wKyivyuCwQlBS9SC/K9htdmONkA+Fc4Uus/ruJNFSDIK8NzRLKUGCS MQhIfKSZ+PJefLklJJ9Z6Eg7e0arSwBB2HUpdhlvX+XfRBYwf7DR2wqD8wcuO7a6sUoQ52W2AJo ZB0S/7R6MJcKVkJX6iiLSnPyRlpvgekvyROq2uyE8Q7XmSxZ/+w1912b8yB2T X-Received: by 2002:a05:620a:2842:b0:92e:44eb:1e7a with SMTP id af79cd13be357-92ecf5f0e37mr1356630085a.29.1783701549520; Fri, 10 Jul 2026 09:39:09 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92ee5bcb074sm235123285a.21.2026.07.10.09.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 09:39:08 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wiEFo-00000007YRj-1Qzt; Fri, 10 Jul 2026 13:39:08 -0300 Date: Fri, 10 Jul 2026 13:39:08 -0300 From: Jason Gunthorpe To: Stanislav Kinsburskii Cc: airlied@gmail.com, akhilesh@ee.iitb.ac.in, akpm@linux-foundation.org, corbet@lwn.net, dakr@kernel.org, david@kernel.org, decui@microsoft.com, haiyangz@microsoft.com, kees@kernel.org, kys@microsoft.com, leon@kernel.org, liam@infradead.org, lizhi.hou@amd.com, ljs@kernel.org, longli@microsoft.com, lyude@redhat.com, maarten.lankhorst@linux.intel.com, mamin506@gmail.com, mhocko@suse.com, mripard@kernel.org, nouveau@lists.freedesktop.org, ogabbay@kernel.org, oleg@redhat.com, rppt@kernel.org, shuah@kernel.org, simona@ffwll.ch, skhan@linuxfoundation.org, surenb@google.com, tzimmermann@suse.de, vbabka@kernel.org, wei.liu@kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org Subject: Re: [PATCH v7 4/8] mshv: Use hmm_range_fault_unlocked_timeout() for region faults Message-ID: <20260710163908.GS118978@ziepe.ca> References: <178345345668.660027.2952911919681614557.stgit@skinsburskii> <178345363584.660027.14063544694872741718.stgit@skinsburskii> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <178345363584.660027.14063544694872741718.stgit@skinsburskii> On Tue, Jul 07, 2026 at 12:47:15PM -0700, Stanislav Kinsburskii wrote: > MSHV currently faults movable memory regions by taking mmap_read_lock() > around hmm_range_fault(). That prevents the fault path from handling VMAs > whose fault handlers need to drop mmap_lock, such as userfaultfd-backed > mappings. > > Use hmm_range_fault_unlocked_timeout() instead. Passing a timeout of 0 > preserves MSHV's existing unbounded retry behavior while letting the HMM > helper own mmap_lock acquisition and refresh range->notifier_seq internally > before walking the range. After the fault succeeds, MSHV still takes > mreg_mutex and checks mmu_interval_read_retry() before installing the pages > into the region, so the existing invalidation synchronization is preserved. > > Fold the small fault-and-lock helper into mshv_region_range_fault(), since > the remaining retry path is just the standard "fault, take the driver lock, > check the interval notifier sequence" pattern. > > Signed-off-by: Stanislav Kinsburskii > --- > drivers/hv/mshv_regions.c | 54 ++++++++------------------------------------- > 1 file changed, 10 insertions(+), 44 deletions(-) Reviewed-by: Jason Gunthorpe Jason