From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 093473AF64B for ; Wed, 25 Mar 2026 15:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774453335; cv=none; b=gIXfYqtk/8pbwaPVXzz58RRGTlyM5kfe/zj4ard1Lad5lr0bWIyZAg1qr1AOvU37qlwrlT/S70PlZFhs7s+vn0tSQzXv2gqRM6Yj6dAE/YJH6VrCPGnBp98z+DUU+DixSl4BNXgROeneYNnVAWd1470UqEL+hILnvQ13kIeNzzE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774453335; c=relaxed/simple; bh=toS7UUE6wFJTL19DVzAONQ7Jlc/gULcgXL/ZAbuTzdI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t8+0VqmAb7Y1BouTexPqK8MUsTP1QBsBjgvMPkNTWt4UMxWDzqOXgMFeAlTbGspJABz8wRFP0MYJYsVIJjYu73KP5nEEZ/HknKCqMx5v/hUDiATz5CjubO3sTf8uPHAuFtRZ4P+tnqVg6pcc8AcRz6A0MALNFolke/DdtXUTVG8= 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=cEfzyRVX; arc=none smtp.client-ip=209.85.221.48 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cEfzyRVX" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-439cd6b0aedso4429556f8f.1 for ; Wed, 25 Mar 2026 08:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774453332; x=1775058132; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ZqPXz+Sa/AY6Vo8qNYqeoHSuweF/2Tg4HA9dNOaxg0o=; b=cEfzyRVXwJ/ySEXBaH7dTEKa+C/dffXAg3dYTU4ISN+5G7nGIy6gaiHG2qN27Sb1GO 5ztsPBRKljNUh1EHk2gNyMo1uaeS90HecqwBallrs1LVldeN+mvQiWXCR6GT33osJeYH grc7YQXeCeqc/4L9wxIkLU1Z7KsU2A5VsefstjsGQxPHEg6Mz5dJtTX1IBMfxcAc1p+P 6XQPmBphvVJagA7Egq2r+sfwIrAJHkFKF7MK5YhZmyWFR5mt3s09I7MEtX2s+niYaAgN TxFXD9cdk4pOL9dfTyVf8GkKghXRyy4rszeeTH/yKe8fJRId2wZDHHFw1zgGa0EvrMS5 6U4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774453332; x=1775058132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZqPXz+Sa/AY6Vo8qNYqeoHSuweF/2Tg4HA9dNOaxg0o=; b=bJgOh1Mk0N0NRI7d1M5CtneLmf2H0Qot0q2wA3ww3xhpCCrmnhhgiqpA/XDZDwXUu+ Q27dr5yjqjYLZTaWLMOldvCVUGCnJf+oKNijhWUnJsYa4H4V4iFFniLBSqUGqn60MYVs SaxgUBrLoDsdqkdq+cFswKkqOoSlFJflNXR7kI0q3vkjFosvp5uxFeVhdqjwZJygyCZe LrpV9TUf/visvrB55u1g+KXuP36ey+P+zSz9BnQMXB1w2j33phb8zbzP345rT/bVS4LU oVq5H4BLGuzjj7BXHaVzuoRK42sZtpsEPxZjNas/RvoLrZfLfCDIa26aLyUmOQ7oZtyF XrSQ== X-Forwarded-Encrypted: i=1; AJvYcCUxsMH1TSFfZwJhx2eL1bm4551xC0oiZA6kNcqoVoj7Dg/tVomyVBwJOzAxgbt8vYibUJjaqXhK8w==@vger.kernel.org X-Gm-Message-State: AOJu0YxkqZ92cvgzmNW7YfZ0M7/kqWsAlcd18UZaF5OMLN88sUsPajkN 6ttrb3WiOJjQWgPttZVYnLohEpMqNC3PhQwRfUMviQO+KsFkxvKwBieX X-Gm-Gg: ATEYQzxDB5GdPVdRy45P/B/oRfEW8AIpQvIiiX9/ZqhUxajvFhTmxTCOlhNfdCqnirh 9CPU9ILDcfaWBajkBoA/vZ12vhgsV518EEyCu0V2eB7m2UGp4WLftbQvsQV9NanpPgWFXaqw825 hOOuwMDUbipqVc4bKCK8tHrb2qZfjZV91dhjEc31X2hhsUo2AVMZPrNYwFrqazs9oJWbtXhd/NJ viC/+y9sIsZmg/wFH+hPy718OahsI2oSBhsiuK8RZ2bW8ogY6FGTSwHumVceZHhGkOxj4Iv/2fm ve5VWoR43HxnF6LdABEyWwNW562M+3OSvdKqscaMD2reGLqT7QgZ0z2ySKkpSWxYFQl01lV9vXA IxVt8Cq/1jsWEdXxft2bjDnkPfTw9Rqorm16M88gkmN6Q1ButyIe5pbNAFufQztYEwbQkVD5G4C rfOZfnDilJ1eG2yV7T4HxRdzmjTHAnsIstULLJOfq4jj86GlHSGvWQMZ3Y7nGwHtM7 X-Received: by 2002:a05:6000:2912:b0:43b:8766:6005 with SMTP id ffacd0b85a97d-43b8899d143mr6042308f8f.20.1774453332131; Wed, 25 Mar 2026 08:42:12 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b919cf2b2sm609925f8f.18.2026.03.25.08.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 08:42:11 -0700 (PDT) Date: Wed, 25 Mar 2026 15:42:10 +0000 From: David Laight To: Catalin Marinas Cc: Ankur Arora , Andrew Morton , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, bpf@vger.kernel.org, arnd@arndb.de, will@kernel.org, peterz@infradead.org, mark.rutland@arm.com, harisokn@amazon.com, cl@gentwo.org, ast@kernel.org, rafael@kernel.org, daniel.lezcano@linaro.org, memxor@gmail.com, zhenglifeng1@huawei.com, xueshuai@linux.alibaba.com, rdunlap@infradead.org, joao.m.martins@oracle.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com Subject: Re: [PATCH v10 00/12] barrier: Add smp_cond_load_{relaxed,acquire}_timeout() Message-ID: <20260325154210.79a621df@pumpkin> In-Reply-To: References: <20260316013651.3225328-1-ankur.a.arora@oracle.com> <20260315184925.b6f93386e918ca79614843e3@linux-foundation.org> <874imftol4.fsf@oracle.com> <20260316233712.7cbfac27@pumpkin> <87ms07rlp9.fsf@oracle.com> <20260317091705.5a64fc56@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 25 Mar 2026 13:53:50 +0000 Catalin Marinas wrote: > On Tue, Mar 17, 2026 at 09:17:05AM +0000, David Laight wrote: > > On Mon, 16 Mar 2026 23:53:22 -0700 > > Ankur Arora wrote: > > > David Laight writes: > > > > On arm64 I think you could use explicit sev and wfe - but that will wake all > > > > 'sleeping' cpu; and you may not want the 'thundering herd'. > > > > > > Wouldn't we still have the same narrow window where the CPU disregards the IPI? > > > > You need a 'sevl' in the interrupt exit path. > > No need to, see the rule below in > https://developer.arm.com/documentation/ddi0487/maa/2983-beijhbbd: > > R_XRZRK > The Event Register for a PE is set by any of the following: > [...] > - An exception return. > It is a shame the pages for the SEV and WFE instructions don't mention that. And the copy I found doesn't have working hyperlinks to any other sections. (Not even references to related instructions...) You do need to at least comment that the "msr s0_3_c1_c0_0, %[ecycles]" is actually WFET. Is that using an absolute cycle count? If so does it work if the time has already passed? If it is absolute do you need to recalculate it every time around the loop? __delay_cycles() contains guard(preempt_notrace()). I haven't looked what that does but is it needed here since preemption is disabled? Looking at the code I think the "sevl; wfe" pair should be higher up. If they were before the evaluation of the condition then an IPI that set need_resched() just after it was tested would cause a wakeup. Clearly that won't help if the condition does anything that executes 'wfe' and won't sleep if it sets the event - but I suspect they are unlikely. I also wonder how long it takes the cpu to leave any low power state. We definitely found that was an issue on some x86 cpu and had to both disable the lowest low power state and completely rework some wakeup code that really wanted a 'thundering herd' rather than the very gentle 'bring each cpu out of low power one at a time' that cv_broadcast() gave it. David