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 E27C1153BD9 for ; Thu, 9 Jan 2025 03:58:38 +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=1736395120; cv=none; b=qLhYkjjHcvazyxebyxglbhzeLCPAdqp3rZCA9rjkxjlCVboHZX8hy5GlXujVmNCnBNXtFsv6b/ZGhxGuiGvYfdQZY45N1d7ljjHG5z2FnKR6DHdxMf5ylGs/mlPjlCfVcZS6cJ8MYW6UXK9aREY3PUTCVCkGQZhnsZCvKnpuMKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736395120; c=relaxed/simple; bh=NR7bujAqHByOJPgv11DJR1ebHw/wXTjmQOE+N8LB4Q0=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=DLftCmG0MT3baXXrzhmH3TxgP60j6x/hZbS0w5dzR4qOzFki2XDvc8gyb+JUYi4OTRVLI/wLSAi+97mWtoy8Z6Ey+IIHtDtNbLT8PxrC8Ju2lCaiW630stsXxoglS583tO6OjjhxRPtBAzgKIodP6mTA0+9Gom6akxwwvf/d3lM= 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=NDOnJAEi; 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="NDOnJAEi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736395117; 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=pK++yYVT6YtXhoG4NvKGkp/wRr7NgbDUOx7+AP4EMJE=; b=NDOnJAEi0T+4d9an0YmMM399QN1ny7s8GolmOCCpwS4n6Hp3jsiOCmjNfbCAE6HjojFTV6 PatL3hmHN0Tc/PDuMYxt8abiFBy6rGVk6uzrcnxLcShSAw1XXH7ZGjYdvHAgmCkFR+DMpw 4KmSQsEJKSDIsBEwqXKcaLQfCaHtV48= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-497-FndiX_gLMiaypazcbgWmAg-1; Wed, 08 Jan 2025 22:58:36 -0500 X-MC-Unique: FndiX_gLMiaypazcbgWmAg-1 X-Mimecast-MFC-AGG-ID: FndiX_gLMiaypazcbgWmAg Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7bb8df9222dso98842285a.1 for ; Wed, 08 Jan 2025 19:58:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736395116; x=1736999916; 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=pK++yYVT6YtXhoG4NvKGkp/wRr7NgbDUOx7+AP4EMJE=; b=GrQwbPnhByTb3atCcFoZhTRrrT1MIe97x5H90NaEX1PjxZm6uZhlz22gfVW6rSFtnf bGMLGOZHF/uVHQQKeuwdtFWcJUjxoXIRuWqaan9hYNXrELbLI1dI1fMijKA226WOgxK4 jBXnhg/J7kgeTeuwz7ws1vvMUVjRsJVecaO8JHDTDjFf5GEYdy3IcXkMcgadsXeaDBMG XZGi7jNNjYB804FH7AWwddtAIK4irYr9qxnOsr5GE+pMPbsbZPGxnC7hqpaJHpUzieQS mbrsx3jnDhO2lX7U19dsHL2+jhmBn+m5/+lsOF1WkYrTpzxdCAzyRAutuAzH1fLbIhfa sWfg== X-Forwarded-Encrypted: i=1; AJvYcCWdiKsTJ0YHbmXDsjqlmUTkz906qMRiwjP/PU9U597fcZJO6k9Z7eTF+VbVIsyUnC4ww6qG7BuwnrC16jc=@vger.kernel.org X-Gm-Message-State: AOJu0Ywp+EChYsubApaC23IOwUH0jRstOPtdS0/Rm4HjkO4f5Y7vlIWV FTlKedHQOyEjbtfoTAeSy25fwY/hGGQkIgeAKGyecO8acmcmQBg4JPpXMxSYaC+vrN4EAuG1hty Xbon5Zv+jHhr4Q46feWwaUPFVD3UZJU5sd5i9Ji8zzJQJA9mgA1+FZyNiWTrvrQ== X-Gm-Gg: ASbGnctdMNPl9QlSj35CdAEAyihOzlDiTMGpCOVZ7AfsmNbns2dgFd7LcsOjmot4GKJ TBBXttmmcDpmVBzoBHNTHPMn2XzLGu9atzQfqyqMLIBMovJgsOhcVnqOJ2m/FQWmJbn5cM5defq eHMGt6ly7e5q7TVHmSL3aPe+rUrJy+Alw5T5NEirMa9fqjQmwucFegru62M7/PX9Z+hdgWcvTWd SUPphi4jhwO9bQdqnv0qS6xR6IvHdZQ6IgU9lyEVnsifxG1jiw3G7UnCUSO6PJXJTufYXMpWAI8 W0SQY0OLrXWUfiYekXFQK+u5 X-Received: by 2002:a05:6214:4111:b0:6d8:8416:9c54 with SMTP id 6a1803df08f44-6df9b1ed60bmr89974566d6.16.1736395115909; Wed, 08 Jan 2025 19:58:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeiTIkUAMhBgbC1EMxAjdJqJuyV96iwPVTqvaKJnAuAR/ttOD8+tajoUO11gY6Ulv+C63/YA== X-Received: by 2002:a05:6214:4111:b0:6d8:8416:9c54 with SMTP id 6a1803df08f44-6df9b1ed60bmr89974456d6.16.1736395115667; Wed, 08 Jan 2025 19:58:35 -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 6a1803df08f44-6dd180ea82fsm196829446d6.26.2025.01.08.19.58.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Jan 2025 19:58:34 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: <745d8edc-d621-41a0-a18f-827989d55738@redhat.com> Date: Wed, 8 Jan 2025 22:58:32 -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 12/22] rqspinlock: Add basic support for CONFIG_PARAVIRT To: Alexei Starovoitov , Waiman Long Cc: Kumar Kartikeya Dwivedi , bpf , LKML , Linus Torvalds , Peter Zijlstra , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Eduard Zingerman , "Paul E. McKenney" , Tejun Heo , Barret Rhoden , Josh Don , Dohyun Kim , Kernel Team References: <20250107140004.2732830-1-memxor@gmail.com> <20250107140004.2732830-13-memxor@gmail.com> <2eaf52fb-b7d4-4024-a671-02d5375fca22@redhat.com> <7f1c3db7-a958-4bb5-b552-a20fb5b60a2e@redhat.com> <0c239aaf-ad07-4be2-a608-0d484bc7fe95@redhat.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/8/25 10:53 PM, Alexei Starovoitov wrote: > On Wed, Jan 8, 2025 at 7:46 PM Waiman Long wrote: >>>>>> As for the locking semantics allowed by the BPF verifier, is it possible >>>>>> to enforce the strict locking rules for PREEMPT_RT kernel and use the >>>>>> relaxed semantics for non-PREEMPT_RT kernel. We don't want the loading >>>>>> of an arbitrary BPF program to break the latency guarantee of a >>>>>> PREEMPT_RT kernel. >>>>> Not really. >>>>> root can load silly bpf progs that take significant >>>>> amount time without abusing spinlocks. >>>>> Like 100k integer divides or a sequence of thousands of calls to map_update. >>>>> Long runtime of broken progs is a known issue. >>>>> We're working on a runtime termination check/watchdog that >>>>> will detect long running progs and will terminate them. >>>>> Safe termination is tricky, as you can imagine. >>>> Right. >>>> >>>> In that case, we just have to warn users that they can load BPF prog at >>>> their own risk and PREEMPT_RT kernel may break its latency guarantee. >>> Let's not open this can of worms. >>> There will be a proper watchdog eventually. >>> If we start to warn, when do we warn? On any bpf program loaded? >>> How about classic BPF ? tcpdump and seccomp ? They are limited >>> to 4k instructions, but folks can abuse that too. >> My intention is to document this somewhere, not to print out a warning >> in the kernel dmesg log. > Document what exactly? > "Loading arbitrary BPF program may break the latency guarantee of PREEMPT_RT" > ? > That's not helpful to anyone. > Especially it undermines the giant effort we did together > with RT folks to make bpf behave well on RT. > For a long time bpf was the only user of migrate_disable(). > Some of XDP bits got friendly to RT only in the last release. Etc. OK, it is just a suggestion. If you don't think that is necessary, I am not going to insist. Anyway, users should thoroughly test their BPF program before deplolying on production systems. Cheers, Longman