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 8A7C35474F for ; Tue, 18 Aug 2026 22:31:10 +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=1787092272; cv=none; b=fJCDfHjB/aS2Obcpt/YSX7fsfp0cHX+FGVTJqkfi3H2XErCW0zrC/8TjqqGkplkWWaDwYVaOsVFTd8JpQx2NZfLcIgCQWEqp+o798AePrUwTGfGEFF4qIGw7NcX0EmfAfZkcssQbMqPsv7TbuZFuWyzjVmaABGm6HpEcqraHz0A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787092272; c=relaxed/simple; bh=cEAUlVrnwFYcUbaih8b4M/AXALgEnPiYvfqYIUSFi8A=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=RAwgWXkn0N2+HI23MBVenYY9xCFi3HzNxlkFWX3LER2gSlSRblJW/N7POZ7cN6jMee3gw2XJaljuLQ+m9vGr81o9ysXgUEBUcX06/YhdeM7HPX4HaJe+5aKo5K2kkQ0i+KTb5JYsJpjh73mrRRmdUncWieYRE+xtl08Iy43BLUM= 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=ADdB+RBC; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=kjJG26F6; 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="ADdB+RBC"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="kjJG26F6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787092269; 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=ka33O0a5qwccrjVpff6VzG4m8rfuJ6C/aWMH+nm7MRc=; b=ADdB+RBCLR9or1v25nZp/LPxABuGPbYz51jc1zG0ZzKPHfyZ7r5jFsuyFqd2YdogmAR/Wk 4kmWNBrVxZEIGWS3HXxfectG4yP1CKUFIQKiHgmMJDBYcbriUdwrAvz9+3NVhzotrvvZjI E1wUBEBbeVnQsVT6OwlkuNC/fa7XXlQ= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-Ceol1JyCNjKfiKeU6QWXSQ-1; Tue, 18 Aug 2026 18:31:03 -0400 X-MC-Unique: Ceol1JyCNjKfiKeU6QWXSQ-1 X-Mimecast-MFC-AGG-ID: Ceol1JyCNjKfiKeU6QWXSQ_1787092263 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-8f1e4e0eac1so2753636d6.1 for ; Tue, 18 Aug 2026 15:31:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1787092263; x=1787697063; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=ka33O0a5qwccrjVpff6VzG4m8rfuJ6C/aWMH+nm7MRc=; b=kjJG26F60XhzRaR94qaUZnqilycuo2xBKNd9EGBY1xLTZJGAfxFJA4p5oKB/aCUxID wfV0RxcgDzOOYTKP4VaWfy4UGiflQ3Ez/wa/oaNGXxBLYQJOFDoHRXKfTugKV7+NW806 fGMoiXIMdSLvWKdakFWJR5Wtt0YrvN15ChoZ/W5iJ4HRxmw9qTiB3kUaIalh34fBFDzj YtmwggdqrY4HSlr2hls9cdlU6Ir5QIpuqfVfBn+yWWIqFVG6XWceDsa7CyeF4PzWOzNr HKLJAm/iZBwSKJX9la79NkuHE1qEyVViiuP4ceJ+Hn0nbYwyauGMZxH30DsbNFaTIv8/ KRaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787092263; x=1787697063; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=ka33O0a5qwccrjVpff6VzG4m8rfuJ6C/aWMH+nm7MRc=; b=H4UbYqJoreZTBgG0A6JP+sc2bWC1TICyCrpUKyPuhwR+Y52TaE/UICn/G0zE2XzDH7 0CdoHL3nhZpzK6jeDfpMVFaup7QjnXnrKI+I9qhxPfRiu2yx7hfnn+iCrkQl/k/jn6Ol VqCAUK5Sk8claMdidtPHRdWQbKjQ8IMM3PvN4220hw4K++uxN6T5KjV11Le9njOofdGp 5wFTUeNY7FfZ6YYFGYH3gYIQyaGPgdRGj0v1wpnemqifr/Gjc0Yoa0YrpRmA16NkHTzq zodlPrY6o4YhXaeXPsV2pVzfy43V4dy82MS8Yvx6w4onw2rak1cTNd/rMT1Xy3e0fVM7 WTtg== X-Forwarded-Encrypted: i=1; AHgh+RpPQ/DUwQxAh3cws9YQDSPdpluK+Yww9Nf6d+D3n7CHzgr5XaOaYLMcOBSEG7QaJcVrL/vlFkbOnPqB9xA=@vger.kernel.org X-Gm-Message-State: AOJu0YxCXDcXU4bYIgzJfNk53bkZPX6x4PHqh1Ls41Lyd6G9TH5UXhM5 x7O2K/bduekN7neDjxYN/iY5ltTfqJKm2rspwwCZuzjuLl9V1pyqXEu4xaN4tEgQ8t4SeRvXKHj NBn1+OLxbbdm3WwyxM/0ruQtm7ghwffTDaWETXhyKH3mSDSRdwZjgcICn9Uv32OA6nwJ/mqEJsw == X-Gm-Gg: AR+sD13JDq3ZX41h6YoUPae7DIeNznoUr+DE5mIvknkTaAT7LRCeFHn3kFy3PmGHRka nP+0IgxKAwPsf327VlrTQCtm0hf4eH5XLfy+vMAQVLjRT+d2pEMUU+QnKLIB516YDGqXM7LD3It Bihf8KpvkpZNU/mtlHu1VNiWo5CNOLB1ED+GB8LxB+TdfYLdqi4Q3Ww+DkS3OC/FgFjhHb87GMx twmhUgZT0k+/Iq/3hgnQbkKfd+t2bUg9f1DWf+q81rce1kcyFogZLXThEXMsLbZGnktwQg/MNbC eUN3bhAtxN6cgOj8NhT3p5icwtBD4No5MG1XSt1GXj2mEmS+Jr9kHxm/A4Up0HpW4UDXNuSxGYA NLXSAc58RaWSDd3BhypRfWfce5wJqwz/V X-Received: by 2002:a05:6214:450d:b0:907:bf2a:481f with SMTP id 6a1803df08f44-90c5e7142cbmr2306806d6.1.1787092262728; Tue, 18 Aug 2026 15:31:02 -0700 (PDT) X-Received: by 2002:a05:6214:450d:b0:907:bf2a:481f with SMTP id 6a1803df08f44-90c5e7142cbmr2305906d6.1.1787092262259; Tue, 18 Aug 2026 15:31:02 -0700 (PDT) Received: from crwood-thinkpadp16vgen1.minnmso.csb ([2601:447:cc01:6890:c623:cd89:345e:99f3]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-90c5eec3214sm226246d6.16.2026.08.18.15.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 15:31:01 -0700 (PDT) Message-ID: <67895578a730d56a50568a7403ba4ef8f7b3e24a.camel@redhat.com> Subject: Re: [PATCH] rtla: Simplify osnoise tracer option setting code From: Crystal Wood To: Tomas Glozar Cc: Steven Rostedt , John Kacur , Luis Goncalves , Costa Shulyupin , Wander Lairson Costa , LKML , linux-trace-kernel Date: Tue, 18 Aug 2026 17:31:00 -0500 In-Reply-To: References: <20260612115121.54862-1-tglozar@redhat.com> <725da8a4ca6a46ea8ba41778971602b49d650e60.camel@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-1.fc44) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-07-03 at 14:11 +0200, Tomas Glozar wrote: > p=C3=A1 12. 6. 2026 v 19:55 Crystal Wood napsala: >=20 > > > OSNOISE_LL_OPTIONS takes three options: name - struct osnoise_context > > > field name (written "" above), path - filename inside > > > /sys/kernel/tracing/osnoise passed to libtracefs, and init_val - init= ial > > > value of struct fields, corresponding to an otherwise invalid option > > > (some options use OSNOISE_OPTION_INIT_VAL =3D -1, some use > > > OSNOISE_TIME_INIT_VAL =3D 0). > >=20 > > Can we simplify by always using -1? Especially since that's already > > treated as the universal "invalid" by osnoise_read_ll_config(). > >=20 > > FWIW using "init val" to mean "invalid" rather than "default" is a bit > > unintuitive. > >=20 >=20 > The idea behind *_INIT_VAL is to re-use a value that is invalid on the > osnoise tracer side to mean "not (read from tracer and) set yet (on > the RTLA side)". OSNOISE_TIME_INIT_VAL is used for values where 0 is > invalid (e.g. period, runtime), OSNOISE_OPTION_INIT_VAL is used for > those where 0 is valid. >=20 Right, it just hurts seeing something called "INIT_VAL" that isn't the initial value. :-/ > > While we're at it, can we move this code to common.c, and drop > > "osnoise" from the names, to move closer to using that only for the > > actual osnoise mode? > >=20 > > Or if we really want to namespace things that are specific to the > > osnoise subsystem (i.e. everything implemented in trace_osnoise.c) but > > not specific with respect to the osnoise/timerlat split, I'd suggest > > something different like "osn_". > >=20 >=20 > They are called "osnoise options" in the interface (although they are > shared with the timerlat tracer), which cannot be changed. I don't > like using an esoteric prefix like "osn". I'm not suggesting changing the kernel interface, just having some convention within rtla (and within trace_osnoise.c) to make it clearer which things apply to osnoise-the-subsystem versus osnoise-the-specific- tracer. It might be "esoteric" which one gets the abbreviation, but as long as it's consistent I think it'd be an improvement over the current jumble. >=20 > > > + * Long long option get/set/restore/put functions, generated from OS= NOISE_LL_OPTIONS. > > > + */ > > > +#define OSNOISE_LL_OPTION(name, path, init_val) = \ > > > +static long long = \ > > > +osnoise_get_##name(struct osnoise_context *context) = \ > > > +{ = \ > > > + long long name; = \ > > > + = \ > > > + if (context->name !=3D (init_val)) = \ > > > + return context->name; = \ > > > + = \ > > > + if (context->orig_##name !=3D (init_val)) = \ > > > + return context->orig_##name; = \ > > > + = \ > > > + name =3D osnoise_read_ll_config(path); = \ > > > + if (name < 0) = \ > > > + return (init_val); = \ > > > + = \ > > > + context->orig_##name =3D name; = \ > > > + return name; = \ > > > +} = \ > > > + = \ > > > +int osnoise_set_##name(struct osnoise_context *context, long long na= me) \ > > > +{ = \ > > > + long long curr =3D osnoise_get_##name(context); = \ > > > + int retval; = \ > > > + = \ > > > + if (curr =3D=3D (init_val)) = \ > > > + return -1; = \ > > > + = \ > > > + retval =3D osnoise_write_ll_config(path, name); = \ > > > + if (retval < 0) = \ > > > + return -2; = \ > > > + = \ > > > + context->name =3D name; = \ > > > + return 0; = \ > > > +} = \ > >=20 > > Using "name" for the value is confusing... "val" would be better. > >=20 >=20 > But it's the *name* of the option/field/argument here, not the value. > If you use "value" you'll get: >=20 > #define OSNOISE_LL_OPTION(value, path, init_val) >=20 > which is incorrect. Would making the macro options in capital letters > (i.e. NAME) make it more clear? That's not what I meant. I was suggesting this: int osnoise_set_##name(struct osnoise_context *context, long long val) -Crystal