From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796281252; b=R74Y94Eec+btBTfBx8lPD1zFZh9iMt/Qbv+O9vJBpAoPkBhra7rmCFeXMP4wePRorgia /Pq1VtFABddJhP10yOJUZMPKAg/zbst96Dwve8kQ6PZYxb+vDIys5+PCbXa/pqDTEaSk+ PbGArl0lUwN2iMcV+Lo6acTde5QSCcLmeI0NuS3yEEOyV5t/SCOfW3RNUx205H3ytal6x /3GGHQlOiw6m6tqVdvzsmvm8fizbjjZnmML5zZg8JRjhoPurDUNyCPUe3yRvKNWTz+Ifa Uy4PiSrnQdH1iVSD4ymrT+JwcPceIc9CY7M3cUHgChKMyShDAW1Utji5Jpcwo8ihNZw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796281252; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=mBWR4e+pkbd6v3n5HccfmvKH94s26ziA4pxptFF4qg8=; b=EZresz6VGD5wPnOtYmmartgQ0QbK+/WhDkCXwSueorTJbvpiBiSVdObJiiDVltqVa2mh nBJoQjc8xyTxu9gnobqCcmj+WWPBFbJZQQaVgdL+tc3nOeqHQHvEkxNM8hamFkdCsfbds Y+TsqT08xyvBPYcEDTeut6reKYK7RtXw2NuzBNSykWrlBNtZePD0nVW2VpJQyDnILE7Vr 0RaBcSgh475RtoTDm2TNXT0gFsfir8j5ipEJv8lVZS51CyEAOwmYUiPivGkJLK004X2Sf Je6B0hcuJE6/dY4K45YViyvOZ9wjxFQcQenSzV3zTElUM4HGgcqj7fpuzOqMX81z2VA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aXrKYv9x; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=iirIpB9c; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB297606A32C for ; Thu, 3 Dec 2026 07:00:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AB297606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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.a=rsa-sha256 header.s=mimecast20190719 header.b=aXrKYv9x; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=iirIpB9c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796281250; 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: in-reply-to:in-reply-to:references:references; bh=mBWR4e+pkbd6v3n5HccfmvKH94s26ziA4pxptFF4qg8=; b=aXrKYv9xiF3HOBtiDUnVtqFu2ephz7AfucsntsI6Rz7CT7Nhqq6AHfY/ji+5erQCPZTQLT 70bCTSM5j7roWXixJqR/7VKxN6PneV3fzXn+vDUlK1oGcLdjPCB9og4Flks9Bkfg7H1YNg zbhsZV3xweeYYDHQYdPynu8O47QKOmA= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-HV2-dLYPObyo02k2yxaBZQ-1; Thu, 3 Dec 2026 07:00:48 +0000 X-MC-Unique: HV2-dLYPObyo02k2yxaBZQ-1 X-Mimecast-MFC-AGG-ID: HV2-dLYPObyo02k2yxaBZQ_1796281248 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-c50715e8328so1008983866b.0 for ; Wed, 02 Dec 2026 23:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796281247; x=1796886047; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=mBWR4e+pkbd6v3n5HccfmvKH94s26ziA4pxptFF4qg8=; b=iirIpB9crBMBg9l0OAPnGz6Er00ICAbY2GTnZHsxuWeg8VGO6Qc4irU3/vYzbsnpsW nR2joSdIb6mSvsYQV/d9to1+UR8jhJu5F6qlEtZLzKDE8drz8/FqLGdxjtClQBGn6Fi+ 9IojtIoO4qwu/U5AL06USMTdYsYJiNwA8AdLs4sRRbHbx5/xRzwWIkyg8UXRiGPJ087d 4h4uNYWumC8l1QzV8lfQHFMzoAUcD9aX/5JfG6BFDhzsHh8MA7kZ0EivEhkpyNmOtY4r E1FPgIiWOnyxAAK7YBL5JJSIl3387u3Li1fN/S29vh6bcmXojhEaTvMFS8HZuXEbVIZ1 o4GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796281247; x=1796886047; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message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dsTs+GGZPFk4Qf30I 7+U7YJlxJzdrIHvhRp5uyCsPLv++BL10PZWXp1rpdVA== X-Received: by 2002:a17:907:a712:b0:c4d:a05:a2e4 with SMTP id a640c23a62f3a-c513a9ae26fmr3170918666b.20.1796281247452; Wed, 02 Dec 2026 23:00:47 -0800 (PST) X-Received: by 2002:a17:907:a712:b0:c4d:a05:a2e4 with SMTP id a640c23a62f3a-c513a9ae26fmr3170915566b.20.1796281246860; Wed, 02 Dec 2026 23:00:46 -0800 (PST) Received: from redhat.com ([2a0d:6fc0:153a:4c00:6468:7acf:febf:a046]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c5248eebe17sm42536366b.74.2026.12.02.23.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 23:00:46 -0800 (PST) Date: Thu, 3 Dec 2026 02:00:42 -0500 From: "Michael S. Tsirkin" To: Alexei Starovoitov Cc: linux-kernel@vger.kernel.org, Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , John Fastabend , bpf@vger.kernel.org Subject: Re: [PATCH] bpf: ringbuf: add wakeup coalescing Message-ID: <20261203014921-mutt-send-email-mst@kernel.org> References: <5663e1035f52f0b358710721c1c77e5c73552a2e.1796135892.git.mst@redhat.com> <20261201192254-mutt-send-email-mst@kernel.org> <20261201195613-mutt-send-email-mst@kernel.org> <20261202020853-mutt-send-email-mst@kernel.org> X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Dec 03, 2026 at 04:03:09AM +0000, Alexei Starovoitov wrote: > On Tue, Dec 01, 2026 at 11:19 PM Michael S. Tsirkin wrote: > >> No. Not every ringbuf is a stream of samples. > > > > Right. What if I limit it per type or something? Can make it > > palatable? > > No. The type doesn't tell a stream of samples from a one-off signal. > A ringbuf isn't tied to a prog type either. > Progs of different types can share one. Right. I don't have a better generic idea, to be frank. > > Shrug. I didn't write this thing. So what can be done about misbehaving > > ones, that hammer the box with wakeups on every event anywhere under /? > > Any idea? > > It's a wakeup per event only while the consumer keeps up with the prog. > bpf_ringbuf_commit() with flags == 0: > > else if (cons_pos == rec_pos && !(flags & BPF_RB_NO_WAKEUP)) > irq_work_queue(&rb->work); > > So slow down the consumer. Try cpu.max on the cgroup of the tool. > Once the tool is out of quota: > > prog consumer > rec 1: cons_pos == rec_pos > wakeup > throttled before it reads rec 1 > rec 2 to N: cons_pos != rec_pos > no wakeup > next period: reads rec 1 to N > > That's per box and per tool. No need for kernel changes. > If the quota is too low the ring fills up and records are lost. Lost records is exactly the problem with this approach. If I wanted lost records, I could just stop the monitor, see? What my patch does is basically like NAPI for networking. This way, the records are not lost. I think I will just have to carry an out of tree patch for now. It's a bit of a hassle but hey. -- MST