From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 D9AA72FC876 for ; Tue, 11 Aug 2026 13:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786456541; cv=none; b=JP/Y6yXN9G/RCz+pEkuxI9GWk/xXLtad2B4mfbaaeX1hmRtFrIFsuNWWEMHBcbS9wx6nRF8CPn1zo3Rv87XrQfPOC+rjh2JO1m/BdnTXSh0nRbxH1BcZgdZjsIE4CVvMTTadw4AhGXsD07znhhRnxqfZlW/vTY7wenHwXKGxMu0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786456541; c=relaxed/simple; bh=2eYYxqEe+PVheZ31u+T+PddfjluSsh9ADg0MARNd0Dk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MJ8fsnMCuOaQ+1qgcz1EBznYcyZklEK5vZnlHv+aK4smDXMRdegyVUc10JougaXScA66PQ+E4vcEQwKheIkUc8zOquvy4p4PlN+q6ER/NgeWd5v47K2C0AKOUOM0fTG0O/AO5v/0btBwIqn6gvYZV9K6dE4iQ+EVSV6PErMX4I8= 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=NlbdNuAM; arc=none smtp.client-ip=209.85.160.182 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="NlbdNuAM" Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-51bfe810293so13661021cf.1 for ; Tue, 11 Aug 2026 06:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1786456539; x=1787061339; 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=xauE7W5wOY3LNWuplU4mgV1n8xBkZN1XfpHr0f+D+b0=; b=NlbdNuAMSsubVfNUyu06VwtNJjCl2mAUricHs+nwFICdOUvmjk/qwsFypDTvzopcU/ kQTvdbXB34Gkw6rJ6AWLRloqMNeBk8orQVkoQmtDyZvCVgWp7Cut56YBbQWuOK6ZhSex koEn++ebpuDuhcjqlLeE0r45xmxTqoEmY6EasJtg5/9kb6lJ+ebTtZsndfhs/AhYCchw jGgVZgiuUO9y2ZDzWDAV8cn3xgoBHQt5MI/pVftqnwqSyHalSV4IQMmC8qZ7l5JPnR1x P3RVGSC3YiDSduHspr7XLVwUirAt4RoeZ5/r7kuG0eXssVH3m/5ggbgJ3VMogOtMeNxB E81A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786456539; x=1787061339; 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=xauE7W5wOY3LNWuplU4mgV1n8xBkZN1XfpHr0f+D+b0=; b=RXfdH1VlkcV3Ziph67+E1MyzcK13eSUa1mPRQfvQGdtSzWmATYUnZsi/Q4SV+Bch29 Zi7OjMMkSLPvub+Xq4BdMXSrHSHIkd04v21d8LdCRiM42+KND4RwvV63qTXubvKmmF49 aK0Jatw0tiOalWMXQYI5boPxAWxLRgcxbX2HgoAfeqStcr48gX0wn5T9IWXuRU9uXe9R tvSnb2GpglOe8QaJ3fpTUZ6b0VgjSOI2xAS2PPyMk9zaoJzhusf8aRXqcy4m1qfcytFf bx9NbvpQBR286D887sLV1iCadeUsgLav8Hql7Yrwzzvv5OFBIHxtxORUKZwi/d1p84J8 H/6A== X-Forwarded-Encrypted: i=1; AHgh+RoVHqzaNuW+Rwd0uvNHScn4giccPoxdnDcgSWyWGHnSCxKrqtiVkjULnl5PvoZykBuIBo9RyZKXswEvkDA=@vger.kernel.org X-Gm-Message-State: AOJu0Yya38Baqwp1khribkKB04OqD14IdKJLi9oOxQtaKRrM4iqqjZD2 jUs67Ig4i5lijdw6OStEBs6HcU6QM8re3jRAGyYO/ISKXEQZC7Xg0fSsMJUEkUZCAao= X-Gm-Gg: AR+sD10LZeuV1v/3N5doS0njSLS2WIslQWeBrP4jkRGNZAtCh4M6yJxOPv6fV9xk2be co8q1sS/PKP3Pmy9MiYFsfyk8CW3GAUqt+RTKnM9o0XkhjYBq4yomt86HmF/R1O8PCR78kVKq/d hwPzmcWk9OWSCbJCiG7I5UmzDT6FrMGa1UuwNaEUQhgrqFhwA8uiLjCs4pClYzIjiCF/OuOg9KU LlL+tnQev0kmOi/O+QJR3aR6gT15yK769Ygh0/kVh1Zj3rjsIVu1QwCFDMzA6q8h05Axxk/rFfR Ao/len1MteolBMCktfa3odWEdJ+yI3G4+OFjITnvcvVpa5ic6VXkNff84ofq7BiPMGSKkEYDLxG eTS6/FlgaO6IOYmgVVidg8D1x6tD4wa8FxWPmxoor4j3mfkVIDkSVgm+X4ykA7TLJ7Gfodg33PN EKMvLuJ9bc7rzko1tXWjJVUj5xT3Z9RsYekxm66g== X-Received: by 2002:ac8:5cc5:0:b0:51c:963:cafc with SMTP id d75a77b69052e-52d5867f904mr29812841cf.41.1786456538732; Tue, 11 Aug 2026 06:55:38 -0700 (PDT) Received: from ziepe.ca ([142.166.156.215]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-52d57c749aesm11606881cf.31.2026.08.11.06.55.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 06:55:37 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wtmx7-00000002UhD-1Ab6; Tue, 11 Aug 2026 10:55:37 -0300 Date: Tue, 11 Aug 2026 10:55:37 -0300 From: Jason Gunthorpe To: David Woodhouse Cc: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Simona Vetter , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Christian =?utf-8?B?S8O2bmln?= , "Paul E. McKenney" , Sean Christopherson , Paolo Bonzini , linux-mm@kvack.org, kvm@vger.kernel.org, linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mmu_notifier: Remove non_block_start/end() from notifier invocation Message-ID: <20260811135537.GC544626@ziepe.ca> References: 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: On Tue, Aug 11, 2026 at 09:58:44AM +0100, David Woodhouse wrote: > As Michal Hocko put it when the > annotation was first proposed (quoted in commit 312364f3534c > ("kernel.h: Add non_block_start/end()")), the OOM reaper "shouldn't > depend on any locks or sleepable conditionals" and checking for > sleepable context was "the best thing we could come up with that would > describe these demands at least partially". Sure, but we translated this into the notifier must run in an atomic context and everyone has been happy with this. > That distinction now matters in both directions: > > - On PREEMPT_RT, spinning locks become sleeping locks, and perfectly > legitimate spinlock/rwlock usage in notifier implementations (e.g. > KVM's mn_invalidate_lock and gfn_to_pfn_cache locks) triggers the > splat despite having no allocator dependency whatsoever. This is > reproducible today on a PREEMPT_RT kernel: KVM takes > kvm->mn_invalidate_lock in kvm_mmu_notifier_invalidate_range_start(), > and if the OOM reaper reaps a KVM process the result is a "BUG: > sleeping function called from invalid context" from > rt_spin_lock(). I don't know anything about PREEEMPT_RT, but this seems like an issue with RT if a traditionally atomic safe functions are now triggering might sleep failures? > - A notifier implementation may legitimately need to wait for an RCU > grace period before allowing the caller to proceed with unmapping That's not allowed. We really want to forbid that, it is not an acceptable way to implement a driver using these APIs due to performance. Maybe change this to #ifdef it around PREEMPT_RT. Jason