From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97002 invoked by alias); 1 Aug 2018 18:50:24 -0000 Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org Received: (qmail 96941 invoked by uid 48); 1 Aug 2018 18:50:20 -0000 From: "me at serhei dot io" To: systemtap@sourceware.org Subject: [Bug bpf/23476] New: bpf statistical aggregates Date: Wed, 01 Aug 2018 18:50:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: bpf X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: me at serhei dot io X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2018-q3/txt/msg00046.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=3D23476 Bug ID: 23476 Summary: bpf statistical aggregates Product: systemtap Version: unspecified Status: UNCONFIRMED Severity: normal Priority: P2 Component: bpf Assignee: systemtap at sourceware dot org Reporter: me at serhei dot io Target Milestone: --- =46rom the 'language features' brainstorm: # Statistical aggregates These can be implemented with BPF_MAP_TYPE_PERCPU storing elements of type struct stat_data. Multiple aggregates can be stored in the same array, one = per aggregate. Then __stp_stat_add can be implemented in kernel-space as non-looping, non-locking eBPF code, while all other functions (reading stat value, histo= gram printing) can be implemented as userspace helpers that aggregate data from = all CPUs. As far as I can tell, it is not strictly necessary to lock a statistical aggregate when reading its value -- the kernel-module backend does this to guarantee a time-consistent snapshot of the different CPU's values, whereas without locking the result might be approximate. # {TODO} More complex structures: arrays of statistical aggregates Still investigating whether we can do this. (0) There is no per-CPU version of BPF_HASH. (1) A BPF_MAP_TYPE_PERCPU would be a contiguously indexed, preallocated arr= ay of aggregates, so a BPF_MAP_TYPE_HASH would be needed to map from sparse ke= ys to indices into the BPF_MAP_TYPE_PERCPU. However, without synchronization, there is no way to allocate slots in the BPF_MAP_TYPE_PERCPU. (2) /usr/include/linux/bpf.h mentions BPF_MAP_TYPE_HASH_OF_MAPS, but it's currently undocumented. Still need to read the code and investigate if it w= orks for our purposes. --=20 You are receiving this mail because: You are the assignee for the bug.