From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30EB5188010 for ; Thu, 9 Jan 2025 21:18:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736457533; cv=none; b=ZpGJT5gt3T8KZqddBcAn9mAYCspwDLISpRl/UD3w9V/O7b2XoRhqBbobkLkXCkJk5A/cqYvbTXGVGfhR41sCApUUi9npGib07BvNiQRy99BBPIoJN2uDIbgPoT+QBkh7pjbBhu1Bw96zE6RzicaO3rpYLeXLtfLMjNXqK0gsZrY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736457533; c=relaxed/simple; bh=Su+Jw+cgZc1WDPAuDKSv3zG2gVu3P1AkQRvgn8D2ICE=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=hCbN8ObgZYzYEE0NqzcrOwRvDG15n4zQMqkJYGL0j2wwo+7v9Yfe72+pHJW8Sd4/ugq7ABcfbnpDMUanPguylozieq9gmCAnNN+UF/PAYNP7kzZQGAD5v1LnbR8B/7KnTiLYFqR8tIfsma813fcIN1AFoNFTeweBQWMrbGQE5BM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CMDAO/+x; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CMDAO/+x" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736457531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PUxg8MKMgCXy+S8yjErvN9FPE1V4L+k8ZTNl9PoflDE=; b=CMDAO/+xhuMK5R9C7IyLRLXDxZTq3xJwdh7w9lww26rJlYoU0TbDAahso3IdR4n13CMzwK wtu+P2+5pK8Ro20HUQ2648n6w95MV3VE4lCHbnsBnHaG7xmRzka++6Y8d6Tl8fglqw+vrp mzprBF7VHADPg1qtrnInA2MULYgitxQ= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-1RXnXWhVN_iFNqIH97pQKw-1; Thu, 09 Jan 2025 16:18:49 -0500 X-MC-Unique: 1RXnXWhVN_iFNqIH97pQKw-1 X-Mimecast-MFC-AGG-ID: 1RXnXWhVN_iFNqIH97pQKw Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7b6eeef7cb8so210096785a.2 for ; Thu, 09 Jan 2025 13:18:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736457529; x=1737062329; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PUxg8MKMgCXy+S8yjErvN9FPE1V4L+k8ZTNl9PoflDE=; b=HIj2IyGiutBXiXWrlEnGro3R37yorWmNZnTc4LqfQ+M4882sdeG5nCZXmdw1kV108i KraGFP0TNHybgVOAVX3IKGQQT6W4iePyxYs3P1wE/s4AzaLAGQqvAaXpDudqznkEAJvG SmN6As6d5QRHfB3f2ShNYboiDmAkMEin2m5rOTvfWMiDBD0qomYVfoBdjOw5GEz6hmeU xrjy99kGRrXCohQ3sqM+1CSmIO854/hjYfssDZjDJL2dYJL44v4zDhBgss75SRMVOyvZ C5z1u7f2gsSlLP5aKQcra1uMMBZSTkzC9o9iezVKHE8eYvlP5H99mdc+LBTmNFgez1+U hLDA== X-Forwarded-Encrypted: i=1; AJvYcCVyK2o90voXA7VNCzPIQgmRVzoksi/QBm1Wjs+Qd0hxMG+OlESq/zSL7wgPGxnmmGsusYwKDptNxTHRf18=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6irqKsOXi3mKNrPdSIrpusFxm29uT6V29YkJELF7AToI/Sb7R cA2GrxabZfyquBXk3AHbnBOy5NpktXKet5FEQpMOIeqGCJ/tQ2gURDEMkukmu0dlI0pftvot8ra HQD29RoA59KHCK9TGuWL0E86dsQRfbZxygbDqrVHIXEjgJhLsGLHIjgl9nqbt/A== X-Gm-Gg: ASbGncuIZAPzzRnMywJ8ya+m2L0dHqq4U0Rp73VBjNgf6miX6BkfS4izwgUAIc/HMEF 2NPcDRva341Y+O6LglPRBWsXAA8kZLWIxhNYaQhkx7/+eIsxFPFSSve4t59ayO3uhAHu8TbL8SJ PxX4YEOOLuCiIGIB+vq/x/aDev1QDpcGL9xDjTCct3ITxBGZ7VDAJcNszCoB2gQVBrdGhW0NUSC tAYI44fG7YUHIWPA8GM3lWOGmCS1C/xLCoSyI/lFv/gHb8zszLPaMWQB0Rp2RatuN7JY4DfJo0k zpkObBjhWPJ9efO0Ph+aWM6H X-Received: by 2002:a05:620a:4444:b0:7b6:5e73:99e8 with SMTP id af79cd13be357-7bcd9710348mr1361819085a.25.1736457529090; Thu, 09 Jan 2025 13:18:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHf93dP9YbrHDeL93rJW/h5zmnn34QfKme8Kf1AzijYw16Cd4WCE57ChHMJ8vmFubJM4przgg== X-Received: by 2002:a05:620a:4444:b0:7b6:5e73:99e8 with SMTP id af79cd13be357-7bcd9710348mr1361814785a.25.1736457528769; Thu, 09 Jan 2025 13:18:48 -0800 (PST) Received: from ?IPV6:2601:188:ca00:a00:f844:fad5:7984:7bd7? ([2601:188:ca00:a00:f844:fad5:7984:7bd7]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7bce3248304sm106303485a.31.2025.01.09.13.18.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jan 2025 13:18:47 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: Date: Thu, 9 Jan 2025 16:18:45 -0500 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: [PATCH bpf-next v1 00/22] Resilient Queued Spin Lock To: Kumar Kartikeya Dwivedi , Waiman Long Cc: Peter Zijlstra , Linus Torvalds , Will Deacon , bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Eduard Zingerman , "Paul E. McKenney" , Tejun Heo , Barret Rhoden , Josh Don , Dohyun Kim , kernel-team@meta.com References: <20250107140004.2732830-1-memxor@gmail.com> <20250108091827.GF23315@noisy.programming.kicks-ass.net> <974db75a-4ffd-4379-8085-484c45702fe5@redhat.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/9/25 4:13 PM, Kumar Kartikeya Dwivedi wrote: > On Thu, 9 Jan 2025 at 19:29, Waiman Long wrote: >> On 1/8/25 3:12 PM, Kumar Kartikeya Dwivedi wrote: >>> On Wed, 8 Jan 2025 at 14:48, Peter Zijlstra wrote: >>>> On Tue, Jan 07, 2025 at 03:54:36PM -0800, Linus Torvalds wrote: >>>>> On Tue, 7 Jan 2025 at 06:00, Kumar Kartikeya Dwivedi wrote: >>>>>> This patch set introduces Resilient Queued Spin Lock (or rqspinlock with >>>>>> res_spin_lock() and res_spin_unlock() APIs). >>>>> So when I see people doing new locking mechanisms, I invariably go "Oh no!". >>>>> >>>>> But this series seems reasonable to me. I see that PeterZ had a couple >>>>> of minor comments (well, the arm64 one is more fundamental), which >>>>> hopefully means that it seems reasonable to him too. Peter? >>>> I've not had time to fully read the whole thing yet, I only did a quick >>>> once over. I'll try and get around to doing a proper reading eventually, >>>> but I'm chasing a regression atm, and then I need to go review a ton of >>>> code Andrew merged over the xmas/newyears holiday :/ >>>> >>>> One potential issue is that qspinlock isn't suitable for all >>>> architectures -- and I've yet to figure out widely BPF is planning on >>>> using this. >>> For architectures where qspinlock is not available, I think we can >>> have a fallback to a test and set lock with timeout and deadlock >>> checks, like patch 12. >>> We plan on using this in BPF core and BPF maps, so the usage will be >>> pervasive, and we have atleast one architecture in CI (s390) which >>> doesn't have ARCH_USER_QUEUED_SPINLOCK selected, so we should have >>> coverage for both cases. For now the fallback is missing, but I will >>> add one in v2. >> Event though ARCH_USE_QUEUED_SPINLOCK isn't set for s390, it is actually >> using its own variant of qspinlock which encodes in the lock word >> additional information needed by the architecture. Similary for PPC. > Thanks, I see that now. It seems it is pretty similar to the paravirt > scenario, where the algorithm would require changes to accommodate > rqspinlock bits. > For this series, I am planning to stick to a default TAS fallback, but > we can tackle these cases together in a follow up. > This series is already quite big and it would be better to focus on > the base rqspinlock bits to keep things reviewable. > Given we're only using this in BPF right now (in specific places where > we're mindful we may fall back to TAS on some arches), we won't be > regressing any other users. I am not saying that you have to deal with that for the current patch series. However, it is something we need to tackle in the long run. Cheers, Longman