From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (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 1C9FF43B4BB for ; Fri, 10 Jul 2026 16:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783701829; cv=none; b=DttR4jgCk7l0d5veHLwTQWA6LxvYIlbeeQDCkIkZXLVG2n7EPYieh+mOUf0fbSl6qP2sUNahQWnJsWHlA4Hr2KggYrGxOn52cAsWUYgmDagbE58kykdovitY9AAzMNpKVmbCZ9IzEwDfb210/h5HgT/RzvSizzwWXd0bxSstxI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783701829; c=relaxed/simple; bh=uIhVIgctXUQcWy00AudXCG6kW+KyBF/3q5iL5v2zEVg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Qkdg3NQuhztfCyfbGG5w5EvB6CoDc8ssTpnFWTrm9w7mbgwejXPyfqWw4mxR+4D41RK3UNIvRsAX7PwSG9OIt58Rj9NlNoG0GV26rMuQdmikFQPbQFIR9JGJZW1vJ6QKHHY9X7+WkwuIhLf9H+7n/nQeG/LTMPMJLfbyAWNGmDg= 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=AyS1Bxmo; arc=none smtp.client-ip=209.85.222.180 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="AyS1Bxmo" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-920f33347f5so58828685a.3 for ; Fri, 10 Jul 2026 09:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783701827; x=1784306627; 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=WXM4slhr2CFKJAVwVD2VemgO6fJY6jlNQ4kyqua9fHY=; b=AyS1Bxmo0N6YHkVKH9oyazzctAf/4C32alIBv/QFTAAa8UmyfwpnYGzVReGFWv+DP3 VcpePWyG1bS/CSWG/+IpVMdTuFeZrVes+MBNYw+9jRJF8pK+0K9aHMt4bLIgaQ/7/9hy VEfaWMdWITdKdLpPAeSE7Qtwa29EwC4oxt3cBiOlEwjIPNBgoy3jXc7Geh1fAHMdfQfZ Kmmja0r7dBY5Rh+6mWUg0+qVA8QOzx1s2Y0bHZcGk6L+fiUylkBBPLREklZMk2T+VfcS x9bojoZx144A8gDBS9ilm5M0wynR0XIEzLUj2z+6xCiHnXv+Il1atWK2ekrdouHfCya1 A7aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783701827; x=1784306627; 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=WXM4slhr2CFKJAVwVD2VemgO6fJY6jlNQ4kyqua9fHY=; b=mwUzXEOhZXEbmtW8TFs/UhGmZPt/UByZYV/fy48aInzFjudSdels85sYvK/+xyFbUj go/DPS8iP8Yw9HPIoyn0JPcFHFcXBclij7FsrZYzrCYCkBm2A7wFNKuB5SRPE3n3BctV Tas/zZlLZOTFId641yX20gnZ2KmTaLGIZ9R2cbA9kbFYwx1psxlva5mo6ucj9Nk1J0ZP fSp0OjCKqK9jglc50RmtHj3m+dxDTrHcHEf0iNQ4A5/KFuj4GF6imSWdIXDQiN85SOmw ba6dNIYhhGJzNMYXW9Owi0KYjUaBzgZfFKqD9zzziZoycehei8cAHXJlgM9baC2SV8sZ BYQA== X-Forwarded-Encrypted: i=1; AHgh+RoTIjCfxtTOc5wy4lFPqD/021n1z2vx+cAPqRcVTonWVt9vmAAAsMj+R4BN4l5dqbKI3+z32XE6Nz2VZgE=@vger.kernel.org X-Gm-Message-State: AOJu0YwWCz04JaCeFLemQnzcE5KGL0mglYkp95cOsGOYEevj+jjJ7yGS SwLulRwpS1q7CMWsdG0Sr7lazz6iUHSGiZ5hi3uoc24Gm/H+diT7wVRTlo05zLX6RsE= X-Gm-Gg: AfdE7cmWNrNFt9PjEfNt8ZI9XSBRhpzAoQ7av016rud9/w5Rj+z1sdb6uahPSf6kQIW IB/xUzXRwLFL6KuqT2zPWjbwOtdyiM4MAK2USxFSeMp7kh6L/yZ6l3eYYqMLudOmezyVjvY3nyz iyMTmzpYn+QuWetSZn5MvHuJ4sqJzyRKf/ok0LAFC+eux+TNa+Nx2mTyLGNYqJY71C/eV1KUcTf rBMEYpdpCy85X713pPC3KsklsF2U/b1sv4VItykP9MUPqQ8lI++tVl36IQTK0pq8geRG6/tG1yk Y1V0xIy+5Us9187rYQyP1Uhaz9i6Y72qqy3z2EjCfiMyjSlDAuaEDC3oXDMV3i1u66pcZXCLXXX xvOxRp+6ap/LHgbLsvXhitf5fUFue6sUuqev97Wj/ugUAGuTLP7H40MxqVcx5y2ws7in031c= X-Received: by 2002:a05:620a:240f:20b0:92e:e569:dc20 with SMTP id af79cd13be357-92ee569e3c8mr347342685a.78.1783701827057; Fri, 10 Jul 2026 09:43:47 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92ee59223e7sm237517985a.0.2026.07.10.09.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 09:43:46 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wiEKH-00000007YpZ-3qzk; Fri, 10 Jul 2026 13:43:45 -0300 Date: Fri, 10 Jul 2026 13:43:45 -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 7/8] accel/amdxdna: Use hmm_range_fault_unlocked_timeout() for range population Message-ID: <20260710164345.GV118978@ziepe.ca> References: <178345345668.660027.2952911919681614557.stgit@skinsburskii> <178345365679.660027.16671418103486907555.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: <178345365679.660027.16671418103486907555.stgit@skinsburskii> On Tue, Jul 07, 2026 at 12:47:36PM -0700, Stanislav Kinsburskii wrote: > aie2_populate_range() takes mmap_read_lock() only around hmm_range_fault(). > It keeps a single HMM_RANGE_DEFAULT_TIMEOUT deadline for the populate pass > and retries -EBUSY until that deadline expires. > > Use hmm_range_fault_unlocked_timeout() instead. The HMM helper now owns > the mmap lock and refreshes mapp->range.notifier_seq for its internal > retries. Pass the remaining jiffies from the existing deadline to HMM, > while preserving the driver's existing outer loop for interval invalidation > retries and for selecting the next invalid mapping. > > Keep returning -ETIME when the retry budget expires, matching the driver's > existing timeout error convention. > > Signed-off-by: Stanislav Kinsburskii > --- > drivers/accel/amdxdna/aie2_ctx.c | 17 +++-------------- > 1 file changed, 3 insertions(+), 14 deletions(-) Reviewed-by: Jason Gunthorpe Jason From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11D9DC44501 for ; Fri, 10 Jul 2026 16:43:51 +0000 (UTC) Received: from kara.freedesktop.org (unknown [131.252.210.166]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA7FA10EF83; Fri, 10 Jul 2026 16:43:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ziepe.ca header.i=@ziepe.ca header.b="CicP3Gt2"; dkim-atps=neutral Received: from kara.freedesktop.org (localhost [127.0.0.1]) by kara.freedesktop.org (Postfix) with ESMTP id 497674702B; Fri, 10 Jul 2026 16:28:46 +0000 (UTC) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=lists.freedesktop.org; s=20240201; t=1783700926; b=CW0/lEpyPCIIQv+6ZqI3mL49T1cP4qaIZncYFOYco+qQbXWJQbAz6PNu2/pq+j5nIWpG5 tWntAiKAf0rCSbSPd2gBE/2DiggBu5PDAjBiXaj0Wubq/2D8ZruBkNa1Endf/kqGe0z864q w8kDvQtCjJHPLk6dtbKtH3FcEeqApZBiB+ZM9hmWT3/ALAvcxHagzPQ8u1SsDoLa/UNaUbW DxxlOXuxiSVvuuUIKAMBYr7WymQxInjnB1UPw6iIeYSQmxWc3Lao3Sd6naE6+plsMvs9IP2 oA14iScTa/6eqJbuBvhQRT7i/Zz+S6fq9ldaszGLDOnmpyB08vT3C4JWY6+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.freedesktop.org; s=20240201; t=1783700926; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=WXM4slhr2CFKJAVwVD2VemgO6fJY6jlNQ4kyqua9fHY=; b=Fo04qnTY6NP1jLp/nTLMiXBawfWx6XUR7SesCJmyF1Xfccd6+6NWny6aprXqHeF46GYoJ XoLLCZhKjuIKXmjD/95E5sMVyL9m5Nn1GLsIr5hu6pSoz2+mmDaklSV1TCeiTV2JH+smhRH /hN9BEWRhTkOhmgdnuukL3y0elV4p1AhCoXUZTt4F56gyml1me+f/Q335B9J7zRF9hniNL0 ka1tmumZcHGTxAx6+LxUue1i0DkBLFjy6iyAaQ4n6kirsXhCymsJ4XqSKKM6xc922pBGgZw DCi+xjMHLAbbzTbY96tKOow3ge1B+NIDQMomzelNEUGxbQT6skiEKvqaqrHQ== ARC-Authentication-Results: i=1; mail.freedesktop.org; dkim=pass header.d=ziepe.ca; arc=none (Message is not ARC signed); dmarc=none Authentication-Results: mail.freedesktop.org; dkim=pass header.d=ziepe.ca; arc=none (Message is not ARC signed); dmarc=none Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by kara.freedesktop.org (Postfix) with ESMTPS id BE8A94022C for ; Fri, 10 Jul 2026 16:28:43 +0000 (UTC) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2672410EDB4 for ; Fri, 10 Jul 2026 16:43:48 +0000 (UTC) Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-92e51d3d83cso57891685a.2 for ; Fri, 10 Jul 2026 09:43:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783701827; x=1784306627; darn=lists.freedesktop.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=WXM4slhr2CFKJAVwVD2VemgO6fJY6jlNQ4kyqua9fHY=; b=CicP3Gt2JIGJE+0qWQ37B3XYL3R451qL9WJoXHxOYILV8FNgzGcs3OCqWkfArce07s Qkv9Uckx34BYNwkbmYb1qn2pq2iIW+qHQ6fQfCuJAr4ynWsqXa62pZEWLr05/gGvHKRx YvGKZhYH1u46QBnsYa7PeTqtUfXV1BAjZQhCpWPY3L6IyHrVQKiAaDdu7wd/D8l0uj1Y ZjiSjk2jE9YB7oSDB8w12wudY979UL43Y5KwN/tmEmvMYK2k5XW+DJV7GezM2g8a3PEZ zfXgSca2hHY/LXoGk+pL7oO7NFObhaFN0vDnP1VJ2Vl9RSYrgZsTX1W7A1LeZGvLuqqv U5jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783701827; x=1784306627; 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=WXM4slhr2CFKJAVwVD2VemgO6fJY6jlNQ4kyqua9fHY=; b=YYmPRazJoi/ZYtQ2qFHLsDo8svYsXe6u4gw4FFYXQyvipclmRs5d+9i8IHIuCKRmjy WG52wcBRUaCdFt5666+7VzU7uNEMK4nK7L4YaomqYjaYgSAmtM1ZtJZh8y7iJIcUGNP2 GpsqPHr0CUJUGnHsWr/9U6mhXlKJb7pX1/6Eh74UgdvCLLDK8xhmJ1uyTDoBGWb2Pg+c 3BkWhaX2ycwDGvH+NWtr8EB4TeEFZBt3bAfC3oHaa6qrhEamync1l6mzYmzXOJbvu4j2 L37SGEdOaUsQsF+YFYg22XeEZBaD/nmegeZtO8RTAFHUnG/NUJhSzPDHEXZ2mMkgP3Gf 4VPg== X-Forwarded-Encrypted: i=1; AHgh+Rqmrr0fAjGloiuIDsgkw1oTGNx8vw4aGQDushB3g/DXP2peOBE2R+a4zxO2xJr0V59Ow1O9J2Vr@lists.freedesktop.org X-Gm-Message-State: AOJu0YyuzD1KE7H8Fzc7Q5pFSYCKq4EbvMD4++KioZYFjWxdNKmnbcUx oLRk1l9mR+SOtxGm4GnAla9QRliaHQUzMiYrmww3S21j4yMKfOR1yMLmXihN+t3u2pY= X-Gm-Gg: AfdE7cl1ff+Ux8v1+O8xAC1EwfA35qmJBCnF0rD6g4nVxBpIGGQ9KNEmVid14i+qYW1 MORHTSrtZxwtrGnI7LlDWS5E2vZZA1O0CJbAXisDnJbpstT/3uARkGFRvw03JyP9VpswtnxnSq1 OiEhZsVd06lji0MMFg375p+9BNd2KIKG/jASpVtahnGdaKFVOPSMmuGr5cdoUQEApN2Sg9dWwDD 7IhNpXqIwxQTItgq5nvlMgpUPHGH9XEbuG6MpxxnDsLi4NuTyyxWngTBifR6XPvFNW6ucpA060I IGR+TNuxqKkqqBuCDkysx9GfVM/ip/1G1sWjqkfVeLQA4jOBK7WVaP3wgP/fIGtqdbonPAFIV85 y6bjPi53ar4G7CVpee0vtMvB5pg2sVMPeEXVbs4tkQMqKDUEuwjRE9TdCLVk5oA094Gg2XtA= X-Received: by 2002:a05:620a:240f:20b0:92e:e569:dc20 with SMTP id af79cd13be357-92ee569e3c8mr347342685a.78.1783701827057; Fri, 10 Jul 2026 09:43:47 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-92ee59223e7sm237517985a.0.2026.07.10.09.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 09:43:46 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wiEKH-00000007YpZ-3qzk; Fri, 10 Jul 2026 13:43:45 -0300 Date: Fri, 10 Jul 2026 13:43:45 -0300 From: Jason Gunthorpe To: Stanislav Kinsburskii Subject: Re: [PATCH v7 7/8] accel/amdxdna: Use hmm_range_fault_unlocked_timeout() for range population Message-ID: <20260710164345.GV118978@ziepe.ca> References: <178345345668.660027.2952911919681614557.stgit@skinsburskii> <178345365679.660027.16671418103486907555.stgit@skinsburskii> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <178345365679.660027.16671418103486907555.stgit@skinsburskii> Message-ID-Hash: AN2OQPHWDRMNNFLP2SDRDUMMDUUUUXXH X-Message-ID-Hash: AN2OQPHWDRMNNFLP2SDRDUMMDUUUUXXH X-MailFrom: jgg@ziepe.ca X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: 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, 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, 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 X-Mailman-Version: 3.3.8 Precedence: list List-Id: Nouveau development list Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, Jul 07, 2026 at 12:47:36PM -0700, Stanislav Kinsburskii wrote: > aie2_populate_range() takes mmap_read_lock() only around hmm_range_fault(). > It keeps a single HMM_RANGE_DEFAULT_TIMEOUT deadline for the populate pass > and retries -EBUSY until that deadline expires. > > Use hmm_range_fault_unlocked_timeout() instead. The HMM helper now owns > the mmap lock and refreshes mapp->range.notifier_seq for its internal > retries. Pass the remaining jiffies from the existing deadline to HMM, > while preserving the driver's existing outer loop for interval invalidation > retries and for selecting the next invalid mapping. > > Keep returning -ETIME when the retry budget expires, matching the driver's > existing timeout error convention. > > Signed-off-by: Stanislav Kinsburskii > --- > drivers/accel/amdxdna/aie2_ctx.c | 17 +++-------------- > 1 file changed, 3 insertions(+), 14 deletions(-) Reviewed-by: Jason Gunthorpe Jason