From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 64F2327147D for ; Thu, 11 Dec 2025 07:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765439942; cv=none; b=TxfV6r0ch95TwvCmWSXPQacIKQYEUkpGY6z08PIjf2B6i9w6IliVuSyPKxa81VRE+9t9k7XWG8og70a/lNoFv63UsNMALVu4Co7vtlsKvQ7bDuWDz7S1bHfm1EWjU1FzTkH3+wcTMxe+wS/j/Z9cpfvUNOILVkaLgt+vvn3k1ik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765439942; c=relaxed/simple; bh=Mt9QZnE5lkC5YqrDO/Ugit0lJ0BF4FeMvc+q9SmfCYc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lubNIuD5IS9F5cplOaTcRgQC+Qr0SEOpgCtZUpQ16NjRN6ZM7FzLtRrBWuQmyli/nELo6283W6ie1RGGdT1tdNzFGL5QXhu7WeFMphsBhYepetKRSuYfRy2MwU7sQfhY+uXcca6bdnL3Q9NmFo1nO1w+UeI2wVIyhzm30/d/7oQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kzalloc.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kzalloc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-295395ceda3so1249205ad.2 for ; Wed, 10 Dec 2025 23:59:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765439941; x=1766044741; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jHLEI3yIxlF2SeW+LUeyty80pSlPWtqXZoQ2zbSMGP0=; b=qEULj8cx62Yj0DbsLDPMV0WS6F56WwaR6pc9cnuJ+9cavFFweRVBNGkordUgSoDRYs fb5cJx5GUX6N8FLPQt2cufdPGEQLDGvQyWsUwpaAaVhfFD+wXaepRGW/XVRQDvHL9FZo ltoHWL+XIs7BZroyp630w7MRpPLKOv9aWJeBLxWk4LU9lfSJJ8buLoWYxNzFI/LcfnIz Kk/dzrvZl88jvHqoho59t710GrD5YXiS9dsBNDAcxaMZqqvQBzMBvkPviozrMdab/w04 uKzvmEmf8aCLiNVDhOwXv+bU7nXBxveyBPtvhOc0D7FeFAMGlOOQQUcF6erCoROU/l9P witw== X-Forwarded-Encrypted: i=1; AJvYcCU5KRHsshRpgqyJBhUWRS6tI01OTJHT0qj7no9CEH2I2PlWVRGUd8+WjpQvC7zNDG06P3KPsSKJ2GIBgck=@vger.kernel.org X-Gm-Message-State: AOJu0YxUmIGDNalzmpWFdO/vnUGVUv0TyCeozIoQ5kxFe1mAnPrj+1H2 5Hm49FL9FmSgOMXv1ZFs+AlOFYN/ymR3dx09+YtDH5cz6G8z5oWL9l0wfJ7vnmVr X-Gm-Gg: AY/fxX4EGYE324nRjTgZUUm+pgNQ14npK/p7BJwWRD8KuLzzL7l3pbXDUBp0LlThtpO oxqmHsYWVVXE/sSrOvUhQsIsnPcDoJ8fm78FUFgBUx3OuYjEhB5qAYn6tyzTw/pXfcQjJjsKdkk zJXFpid7d2fWgW5Ufz6f86b7dmFD5+hlldyrP0DkHWduVMoN3RwZidD+2hdxrcuSxz9rFaqeBhD wwfJ0sbpNXt7ZC/UYjBqmqyO0CjO/6oE1yvSp9lb0w71CIxJOsvwy55MS9tsyq9iGfFQ3EyovtF zb/ZyD6muQmpn4qeRWnWXHY6GyNwEAPVNjC4MAjc9+k62vsi9SzCJ0I/LYG+stsOKnnM7OcUW47 Wyp9x3nxRvKTr0xn0qJD8knvvt3SohXU8S/wzEYsJpwxHhwOkii+Nk2foLBd+91/138p091wAry bQqJDIuO0R+QaLgeBS1Zp0bQdTV9oPqgJxGJTnSPf7/8Py3sheyng5jvd1RtpF4g6VtXSo4Ctaa cQscjZ36ITtQYWjK+FCiFs2Y7oiiI/GUiBawe4= X-Google-Smtp-Source: AGHT+IFlqKaRh2bfJ3VCJkDpWOTUAteyNHAB5/4458kCz15TVb9HB5AvTiivXYoIvGXl/ssc5/bjNw== X-Received: by 2002:a17:903:40c6:b0:272:2bf1:6a1f with SMTP id d9443c01a7336-29eed2836ecmr13470455ad.4.1765439940704; Wed, 10 Dec 2025 23:59:00 -0800 (PST) Received: from ?IPV6:240b:10:33c2:3400:bf22:fa0d:c020:cbe3? ([240b:10:33c2:3400:bf22:fa0d:c020:cbe3]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-29ee9d38b3dsm16058865ad.36.2025.12.10.23.58.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Dec 2025 23:59:00 -0800 (PST) Message-ID: <0d06ce4c-6ff2-401a-90d9-5a4dfd2abebb@kzalloc.com> Date: Thu, 11 Dec 2025 16:58:55 +0900 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: [Question] Detecting Sleep-in-Atomic Context in PREEMPT_RT via RV (Runtime Verification) monitor rtapp:sleep To: Nam Cao Cc: Sebastian Andrzej Siewior , rostedt@goodmis.org, Gabriele Monaco , Tomas Glozar , Shung-Hsi Yu , Byungchul Park , syzkaller@googlegroups.com, linux-rt-devel@lists.linux.dev, LKML , Dan Carpenter References: <32839fb6-dbcb-4c5c-9e3f-d46f27ae9a73@kzalloc.com> <87fraslu9c.fsf@yellow.woof> <87jyz5kuf2.fsf@yellow.woof> <20251202112644.YUux4LKd@linutronix.de> <53f17978-40e5-4b2e-b719-552612b0e775@kzalloc.com> <871pl1y3oh.fsf@yellow.woof> Content-Language: en-US From: Yunseong Kim In-Reply-To: <871pl1y3oh.fsf@yellow.woof> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Thanks you Nam, for pointing that out! On 12/11/25 14:42, Nam Cao wrote: > Yunseong Kim writes: >> I specifically believe that RV can encompass the role of >> CONFIG_DEBUG_ATOMIC_SLEEP and even go beyond it. >> >> My reasoning is that even if a sleepable (PREEMPT_RT) spinlock is used >> within an IRQ/preemption disabled section, CONFIG_DEBUG_ATOMIC_SLEEP >> might not trigger a warning if scheduling does not actually occur (i.e., >> if there is no contention for that spinlock). This is because the actual >> debugging check happens in __might_resched(). > > That's not how it works. See the description of CONFIG_DEBUG_ATOMIC_SLEEP: > > "If you say Y here, various routines which may sleep will become very > noisy if they are called inside atomic sections: when a spinlock is > held, inside an rcu read side critical section, inside preempt disabled > sections, inside an interrupt, etc..." I am currently considering how to model this to cover cases that go beyond what CONFIG_DEBUG_ATOMIC_SLEEP covers. My specific concern is about custom functions where might_sleep() might be missing. In such cases, if the code hits a fast path (no scheduling), CONFIG_DEBUG_ATOMIC_SLEEP won't trigger. I'm wondering if RV can detect these potential bugs. > Nam Thanks a lot for the quick reply! Best regards, Yunseong Kim