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.133.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 73BEE3CFF5E for ; Thu, 11 Jun 2026 10:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781173863; cv=none; b=NgY5H1JhcIewsj04vWgfj8NNUyRKds6xHS5ihmmC5LGXvIOZDT3TtHU+955VcDWmERdgAowaRcf2UWka+JskmPIH5a71ydhGH+F7DUtl4k/MZEAzgi7CdeTkWNq66bcv9mNykahpq92+d7ZSnQW+59ru5n/b4FmOALBySC10qak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781173863; c=relaxed/simple; bh=yJPfJ6ioiiG4sQQzoZlIXOe1TYUdO+IIKqMshZ6NXwM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=SLcL+L2x/MbX5WqhJDWuFq+UdNvOS/HsIr+6gregfTG+doTvcRT1B+DmNQY1GOffgk2s5Dqh2GtmuBB3p8sgbH0AVUP8DtpuHFo7RpOQGiFYvDErGiJHMLPdioMPTrp9oxmqHaeveBR03EMtIYfSqWgfXldfKyOZwElK/HrSc/E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=LB01KLuS; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Rgasx6Yu; arc=none smtp.client-ip=170.10.133.124 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.b="LB01KLuS"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Rgasx6Yu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781173860; 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=V8uctc9+aAOAb1j01brzPJHvMVOuj0goYp0HtlmUdJ0=; b=LB01KLuSku7F6B/Siy1enQF3gPRgN3kT4QPfxVKSHXC1m2C91798R/+tbuxi7DFELEyGLr yPCAPEFkoNEhERfeZI5G1OlKZRGhy890FrIyz1wsvc5vvlpEaPyWsh9dZm5SXGHyroTGWq ZvuLd0njjWa4NBvhnEgZQG2P1Ub6Jx0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-564-kfb7fMMlNrmWiiFnHkVW0w-1; Thu, 11 Jun 2026 06:30:59 -0400 X-MC-Unique: kfb7fMMlNrmWiiFnHkVW0w-1 X-Mimecast-MFC-AGG-ID: kfb7fMMlNrmWiiFnHkVW0w_1781173858 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-490aadb1386so3866925e9.0 for ; Thu, 11 Jun 2026 03:30:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1781173858; x=1781778658; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=V8uctc9+aAOAb1j01brzPJHvMVOuj0goYp0HtlmUdJ0=; b=Rgasx6YuLD6SBLZ1QRJApV6VgIg+o+JurYJiPBovEV/BXeJdkpGGb1Shyd9pCU6kG7 Esw2/VaDCE4bS0xc+QIRvXOaU9qQbNTP4Vt0RiTBUFaeZhTFkDIs793vnH0snvVx6Iis +JUywWiXn2qqGsBlUKH4P/39y6EIgntQufNunX+hskxiRpMFxOeAJkXV+mBrVL5OzsqS BMfleIWkXkQM/RXZjC2fhQbIrIUY/qrH+4olp/y9E7asd4VcC7xAouqFaJNcGYb3VTNS EAIR42Mv/4w0Ah1pYXQ4DLByYvtefkuEBvDbGkB4gRUrMOLtgVp81Dli3h+p6/TzjTLR pk9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781173858; x=1781778658; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=V8uctc9+aAOAb1j01brzPJHvMVOuj0goYp0HtlmUdJ0=; b=ICO92tbIdC4QMUv2fByQ8CdhkhX6CVT9xXSZkZgO0Ie/CWMn9PejpH67uSajaF1LPR zHYdDxDyAYOAUZ3AM805cK+92s/tiq4daKMcTavbQFM0eXInybUu+NWlnMzpBFGKDOpF dva8HzZjVsSXC4DrvnrFwXXxjYMT1JpXjMlZKVG47iiMgubKiXS4DniQ0DADxOrmTaZN UeiZXr344WaEt0hmu4tHesB7gltQbKidcPph87W0BOsshEQUZ/m/8FM9K3+XqhW2aS3i hm77+657G/yf2yKipsIYkvaBhrf82OfaNtp7XZKaVfjrQlfFIslkO8AmeFdSl4iiOyi8 Flyw== X-Gm-Message-State: AOJu0Yy2j4GQet4Ni4oCwRZPPSxcHfObqIgguKAF0iaTjGe73Il+sQWs ytIrRJQKTr8SkEPaNznvy62kmWncpdKG7jG31jKmLCEcCHwuRejLyT09xHR47n3f4Cga3gScSWe dc6ObHlvJ/P0FsAuH8yA5QGYDsTzbTz/WtEeSEHC5ZQ7HnOvnEAfTARA25g7mpR3+XQ== X-Gm-Gg: Acq92OHevan4WmPGQYd8Kq2BkYMsp01gO/IGcH4Vj6RvIZJzO5XNqc4Zm1ysxZywFVS WYR9uPqQ5SU3UVP59BDGiwkhN7Xhcpi7YR4A2PWuXNECOQVqdvqHXZbNCkTzbJeTi+EIxXdtS7j lQc+u323fhiBwEpRtGNEo5N1KC95IFLR/bVBVBHe7x8RN5hZqdyjLTgJA5UAnRyDENSnLbi8vBv PoFG5RhKXTaK6ixbAydBlGOkK6SL+kbxD2WumeffV98wo1l44n/P6/r+kIzDT/aqSeWu+IzQ7m0 vHdp2xGsQzAWLzfIsUW1ASaObNIpABr+WcoTnYCqDgnT2X3Cc0wLbMEln6oaXp2ZJLBBzGnjrz0 vChSZrIe4ZpOr2GOaogpR6iyAMcxzWwkVyQt0+hwqLW4NlejQxnjlaFhGVO5vGy3lHnpmzyFcVn QotjDEwHTXW3tlEu8LqA== X-Received: by 2002:a05:600d:8444:20b0:490:7df7:9190 with SMTP id 5b1f17b1804b1-490e52dfc5emr16161705e9.8.1781173857867; Thu, 11 Jun 2026 03:30:57 -0700 (PDT) X-Received: by 2002:a05:600d:8444:20b0:490:7df7:9190 with SMTP id 5b1f17b1804b1-490e52dfc5emr16161405e9.8.1781173857304; Thu, 11 Jun 2026 03:30:57 -0700 (PDT) Received: from vschneid-thinkpadt14sgen2i.remote.csb (213-44-135-146.abo.bbox.fr. [213.44.135.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490e2c0d360sm63347395e9.0.2026.06.11.03.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 03:30:56 -0700 (PDT) From: Valentin Schneider To: Tomas Glozar , Crystal Wood Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Costa Shulyupin , Ivan Pravdin Subject: Re: [RFC PATCH 1/2] tracing/osnoise: Sample IPI counts In-Reply-To: References: <20260610130457.1304245-1-vschneid@redhat.com> <20260610130457.1304245-2-vschneid@redhat.com> Date: Thu, 11 Jun 2026 12:30:55 +0200 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/06/26 10:59, Tomas Glozar wrote: > [just replying to comments, will do a full review later] > > st 10. 6. 2026 v 21:51 odes=C3=ADlatel Crystal Wood n= apsal: >> >> On Wed, 2026-06-10 at 15:04 +0200, Valentin Schneider wrote: >> > Osnoise already implictly accounts IPIs via its IRQ tracking, >> >> Does it? It seems that IPIs bypass the kernel/irq subsystem on some >> arches (including x86, but not ARM). >> >> It would be nice to solve this properly by adding generic ipi >> entry/exit tracing (similar to what ARM already has). >> > > Isn't that precisely what the ipi tracepoints used by this > implementation (ipi:ipi_send_cpu) are for? > Well, these catch the emission of the IPI, which is great for investigation - slap a stacktrace trigger and you (most of the time) get the source of your interference. However Crystal's point is that on x86 (and I assume other archs) receiving & handling these IPIs is "special" and doesn't go through the generic irq subsystem and thus has to be tracked separately, which is why osnoise has this fairly lengthy osnoise_arch_register() thing. >> > however it >> > can be interesting to distiguish between the two: undesired IPIs usual= ly >> > imply a software configuration issue (e.g. wrong/incomplete CPU isolat= ion) >> > whereas undesired (non-IPI) IRQs usually imply a hardware configuration >> > issue. >> > >> > Signed-off-by: Valentin Schneider >> > --- >> > Note that this is modifying the osnoise:osnoise_entry Ftrace entry; I = know >> > trace events are sort of supposed to be stable, but I'm not sure about >> > ftrace entries. >> >> I think old rtla will be OK with this since it looks up fields by name >> rather than assuming a fixed layout. >> > > Yeah, the fields are either looked up with tep_get_field_val() [2], or > with name-based BPF CO-RE relocations against the tracepoint structure > [3]. So this shouldn't be an issue, as long as the old counts stay the > same. > > [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/t= ree/tools/tracing/rtla/src/timerlat_hist.c#n191 > [3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/t= ree/tools/tracing/rtla/src/timerlat.bpf.c#n12 > >> > Alternatively I can have this be purely supported in userspace osnoise= by >> > hooking into the IPI events and counting IPIs separately from the osno= ise >> > events. >> >> One benefit I could see of doing this in kernel osnoise would be if you >> could atomically correlate the count with the particular noise >> interval, but this patch doesn't do that. >> > > The count is already reported by cycle on the kernel side in the > patchset, right? It's only missing in the current RTLA (userspace) > part, as there is no statistic using the information. But it can still > be collected through custom histogram triggers. > >> > ... >> > >> > +static void trace_ipi_send_cpumask_callback(void *data, const struct = cpumask *cpumask, >> > + unsigned long callsite, void= *callback) >> > +{ >> > + struct osnoise_variables *osn_var; >> > + int cpu; >> > + >> > + for_each_cpu_and(cpu, cpumask, &osnoise_cpumask) { >> > + osn_var =3D per_cpu_ptr(&per_cpu_osnoise_var, cpu); >> > + ipi_emission(osn_var, cpu); >> > + } >> > +} >> >> Isn't this racy to do from a different CPU? Both in terms of the >> counter, and the timing of the increment relative to when the IPI is >> actually received. Not necessarily a huge deal if you only care about >> zero versus bignum, but still. At least worth a comment, if we go with >> this approach. >> > > I also think it's a bit confusing, especially as the other accesses to > osn_var are cpu-local, but here, "cpu" is the *target* CPU, not the > current CPU. Not sure how expensive it would be to do atomic_add for > that, at least it's something to consider. > I suppose that could be an argument for doing that stat aggregation in userspace osnoise - event handlers are run after the fact via tracefs_iterate_raw_events(), it's all inherently slower since it's just increments of one (one per handled event) but it's also all done in userspace on a control thread and doesn't bog down the kernelspace. > Tomas