From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 2F3CA26B74A for ; Mon, 15 Dec 2025 21:40:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765834820; cv=none; b=U/tq/7bKB5+uGIBynvqHm9uhY2scObpiEPBvZp3X8v2Q0Xro1eZhzYQsraZlUZqJrkTj7a2JIONHUdlEFjNKKmrJdl4eF8wnWieorG03wT2+CyDSyFN8vmiUZrOJ3veS9EM/oYGDAHZONxtas4R4PB2YiVmO+o7pA0IZHhX7rDg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765834820; c=relaxed/simple; bh=Y9B0PrO7eep9Md2S3cwjSR2T7fsBiwkpWkQ81Zxh7oM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=eeNXNV/dP1V19XuUOwApc8GaBMRi0UXZVh4Y0i+N72pPBjCk0mikWN9H5cDAwTR0b6MFpteXlNcTV4alR45tQZY5vJ7Yp7uzb1JXz6s4b43z6o4XS5XIc9g9Pkfg+lBYBwqQnxIphz+/wjR8bA6QdYFwt3NhcLDh+mUiEcnZ5AU= 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=QQLrXJ5J; arc=none smtp.client-ip=209.85.128.44 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="QQLrXJ5J" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-47755de027eso27139925e9.0 for ; Mon, 15 Dec 2025 13:40:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765834817; x=1766439617; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PtrYjcDo8W8ENLiooSwtuxxlBPD0y00FacSVPre/Faw=; b=QQLrXJ5JAUOzJ8Yt1jyd5kWZKLwJD6LCSRU0Tj/6IcYefX0Ty+qXaOOCXoVzD161Hm oz1eXEiyEZs1Db+2tRL0QVbtnLpASsry3v+lyOkqjtXFqQabduvZnaDnAunDTa7qJ4uP isD3IBOOlgDrc4PazKAYDV0GyoixAfeSmaHIZHKU3IJMZfasrCR9xa4SepsW9x1uuZZD GEHl9BIInSVE/5ZEdpq/SmJoxLGSqd2AAQgzRqUxhsbx3x9kt9KPJR977m/JDxTY8LTx Btuo/BDu9wLR4eu9NOnrxRc6XFAqYzAHNUMPU/Ql/xAVuXNFaz+oquG5jC0STwf0D3Nu p1TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765834817; x=1766439617; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=PtrYjcDo8W8ENLiooSwtuxxlBPD0y00FacSVPre/Faw=; b=a+E8yGwgBhC/jMhY358jxuWGDMjt2DioBNPb/8aozcHoh02n4asvYny7dsdpV0tmzg sWrDDu/VfMdHg1TmFIlN6HPXVbm0FdLhH7E2O8Oxpf2hZle9zkLuf/YUEsVfqEusqc7N f9uN9dziUY8hm0s32yDpltsGVGbFi2Yz2wxlCs83FrwC8+eY4N5dD9GdSKGZQFy2PMTu s9bUt5cVYAPwEMIFAOvDurbHyyz7jDj083Ef42GrffSjfHejutO87VOTsAoFl/1AU9jt dsGosNCvBLvbfT5X6WrOvzk5H6bE9H72evLBT95el8vBOGuuYdNmChlKHpELWgh2mDUl OjnA== X-Gm-Message-State: AOJu0YxFfx646wHp+rUxcJ9HuzEkeiubhZ5Ev4mVt4DPFzFpxf9Fwzpz MSDDApF5MjYzNVgS0Hv5rIRPbKQMX9/Apljy8XZq+pCjlehojMVOPAVh/jfozlpfXRizTWm2X4s Noy75bXio81tGhT0dzbpznkRTqegw36y9USAB X-Gm-Gg: AY/fxX6xxuTMqOAPX0bWb6vLNs+M7gD6PfEfxzjvwlRnA0TIWJ3MfDCCwNsbrqxtQui Fvm3NIvqRH1RBZZuQm/KDhU7Nd/csGXRkCpV2o/FEQmmQfMORE/Pz4DxbVXcytALADjysPkDvln BKSJO2Ef5LmDPwBJ4O7EBValw5+TvrdrTcpZoKZ64LTyqzdwqA04ZJqe1d2S0HHCoAxOVfyliSo jf20e2WDNYNbXmAamLW+bb/by7IwbxXkeUuF8maY/1dO6C0Imr9FnHrIqCxAkSwfhumGSh2XA0d Gb8HaEnaVsBp4qQvhsoiQ2UXzk1q X-Google-Smtp-Source: AGHT+IFLwg9qrtGIR+KKSJwR/7/cX3U7rq6rlbIqE5QA9N+Q5KZyJ8O41sxw+c2I52/X9p3wPLvNSGsFlF/3a+MqKoo= X-Received: by 2002:a5d:5f82:0:b0:430:fd0f:28fe with SMTP id ffacd0b85a97d-430fd0f2a7bmr4935997f8f.31.1765834817292; Mon, 15 Dec 2025 13:40:17 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20251215044919.460086-1-ankur.a.arora@oracle.com> <20251215044919.460086-11-ankur.a.arora@oracle.com> In-Reply-To: <20251215044919.460086-11-ankur.a.arora@oracle.com> From: Alexei Starovoitov Date: Mon, 15 Dec 2025 13:40:06 -0800 X-Gm-Features: AQt7F2rQ1ApFWmx4BVk_0MGk_PcVWn8dueHeO96jKZChfmmCmjnf-YqQHmYoFps Message-ID: Subject: Re: [PATCH v8 10/12] bpf/rqspinlock: Use smp_cond_load_acquire_timeout() To: Ankur Arora Cc: LKML , linux-arch , linux-arm-kernel , Linux Power Management , bpf , Arnd Bergmann , Catalin Marinas , Will Deacon , Peter Zijlstra , Andrew Morton , Mark Rutland , harisokn@amazon.com, Christoph Lameter , Alexei Starovoitov , "Rafael J. Wysocki" , Daniel Lezcano , Kumar Kartikeya Dwivedi , zhenglifeng1@huawei.com, xueshuai@linux.alibaba.com, joao.m.martins@oracle.com, Boris Ostrovsky , konrad.wilk@oracle.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Dec 14, 2025 at 8:51=E2=80=AFPM Ankur Arora wrote: > > /** > * resilient_queued_spin_lock_slowpath - acquire the queued spinlock > * @lock: Pointer to queued spinlock structure > @@ -415,7 +415,9 @@ int __lockfunc resilient_queued_spin_lock_slowpath(rq= spinlock_t *lock, u32 val) > */ > if (val & _Q_LOCKED_MASK) { > RES_RESET_TIMEOUT(ts, RES_DEF_TIMEOUT); > - res_smp_cond_load_acquire(&lock->locked, !VAL || RES_CHEC= K_TIMEOUT(ts, timeout_err, _Q_LOCKED_MASK) < 0); > + smp_cond_load_acquire_timeout(&lock->locked, !VAL, > + (timeout_err =3D clock_dead= lock(lock, _Q_LOCKED_MASK, &ts)), > + ts.duration); I'm pretty sure we already discussed this and pointed out that this approach is not acceptable. We cannot call ktime_get_mono_fast_ns() first. That's why RES_CHECK_TIMEOUT() exists and it does if (!(ts).spin++) before doing the first check_timeout() that will do ktime_get_mono_fast_ns(= ). Above is a performance critical lock acquisition path where pending is spinning on the lock word waiting for the owner to release the lock. Adding unconditional ktime_get_mono_fast_ns() will destroy performance for quick critical section.