Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp246570rdb; Thu, 1 Feb 2024 07:28:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVWVywPz5Hkwg/UP2cysXpvySIv55Bu7BBoNfKu51nvnVfUCbe1v3aXzflN58ucjz9Dwo2 X-Received: by 2002:a17:903:2402:b0:1d8:e4b8:95d6 with SMTP id e2-20020a170903240200b001d8e4b895d6mr4481043plo.27.1706801304560; Thu, 01 Feb 2024 07:28:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706801304; cv=pass; d=google.com; s=arc-20160816; b=zzciArP+pf/ip2qz/ZHhy49CSYYQSARdmL0Fz9xhXS8JnW3+g7SUgUfNgPFLwYqGyb qHiLuitsVpCKWAx4WdhyXaJiMAmWivAHYslfbhdZu703V4rAWWw+xxbvnDFYTpJ+RczV pPv6qi0yS0vrkpcCfEuqfjlL0heI0FshKtH/32D/E50a9qJi+ba61AJxyz0LpO/yoB12 5gKwKCWtpNBuDF4YIw8wdpGZXnbvecZGgyR1r7nUdRv5Sct+78RcqVe0zjat1jE2+cXf G5MGtc+2am0BXJIkI+xwpU2dehCaluGvCh3DWiBxr6oi2r3LXdGR/0rMRKpcu8UbwUJu 6Pog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=wMuaSoLrdfKf300wiQlP+lJUfAehOCyPpCMKbUnt0yU=; fh=9kkbh0jeT0cdxjwynyHsiQlUHfq7tlR0sRsGJuNFUJc=; b=Z4ZY7sDMDbnaansnrcF59dWUF2zvWar/hkiWXGI3Uq6kVctDM9Yky9N5jP5uaI2ykF yltmbe05phqxe04E+GEfIcGyaF5Gf7P2DrUhb0G5/Fz24a5QRcGkKqmoawGLGaakH+Sr wdn6wZbGgM3HWc2Hqc+9hHQvyE8rgnQySNsMEzmLT0Orvx+7RaNQdFBN1EVnv3fr/DQX 4Qjp6Mf2UsFYwFAcIY40XKVklaoged8r18/kv5Zd4kH5lMa9nU7gcDVlaOWZ/ZTbyn71 xk4XfZP0iapGRZqTDoijEM3fXYw2TvgmGpoobBk9pjRek+Pjqx9VB3SL94cCCHMY8cn3 ayYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-48395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48395-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWj02Thjfquv8iZDnctd05YkQk9L4Llm4sT/BcwxWsEzDHek6QyaFOdUAAeRD1LGVfRbPe4ud2f50243jK1rMe8bRp6PZ87yE6bschKMQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w13-20020a170902e88d00b001d94a0198dasi1500478plg.68.2024.02.01.07.28.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:28:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-48395-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48395-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 58153288B6C for ; Thu, 1 Feb 2024 15:25:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C044D626A7; Thu, 1 Feb 2024 15:25:11 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3B6784D9E8; Thu, 1 Feb 2024 15:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706801111; cv=none; b=MA8yhYepJ+ysMdzGng8NQh/rnnDjv7MvQy2K2dbxNuF+w6wor4sx/zA4Be8CCOxSNb+m/8mM0GYePtU+bBnFqmHYcBuWq79olVsbMGdROQ6yI8U1TJpLZI+c7iqreC9GicHNpbLVWb0dRL6NKgRkA20SOqCXTuVZ7YasBBjj8I4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706801111; c=relaxed/simple; bh=zyF+oC0KhaCRJdYaOP/LR6wR/KKdYs6b1ilnbWMO22Y=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=omQsL1BaCsw4lleyAcFRsWLmknU0F13qs4+18M6a0if4v4rC+9SNkjamRSM+rzmkldiaQWFFkgkhFTEjuHSSBnrYxbooKBrHDDj791q8P8bbOwBMnjgKaW+cHrmck22WaTMqr2SohK/+gOXYmuKxq/rv6qpUmAz6JPufi1jJA8I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1049CC433C7; Thu, 1 Feb 2024 15:25:09 +0000 (UTC) Date: Thu, 1 Feb 2024 10:25:26 -0500 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: Masami Hiramatsu , Mathieu Desnoyers , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] tracing/timerlat: Move hrtimer_init to timerlat_fd open() Message-ID: <20240201102526.755de868@gandalf.local.home> In-Reply-To: <7324dd3fc0035658c99b825204a66049389c56e3.1706798888.git.bristot@kernel.org> References: <7324dd3fc0035658c99b825204a66049389c56e3.1706798888.git.bristot@kernel.org> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 1 Feb 2024 16:13:39 +0100 Daniel Bristot de Oliveira wrote: > Currently, the timerlat's hrtimer is initialized at the first read of > timerlat_fd, and destroyed at close(). It works, but it causes an error > if the user program open() and close() the file without reading. > > Move hrtimer_init to timerlat_fd open() to avoid this problem. > > No functional changes. It can't be fixing something and not have any functional changes. No functional changes means the code is restructured but the resulting assembly would be the same. Like moving functions around in a file so that you don't need extra prototype declarations. Please only add "No functional changes" if the function's assembly would be the same. > > Fixes: e88ed227f639 ("tracing/timerlat: Add user-space interface") With a fixes tag, I'm assuming his should go into v6.8 with a Cc stable? -- Steve > Signed-off-by: Daniel Bristot de Oliveira > --- > kernel/trace/trace_osnoise.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c > index bd0d01d00fb9..a8e28f9b9271 100644 > --- a/kernel/trace/trace_osnoise.c > +++ b/kernel/trace/trace_osnoise.c > @@ -2444,6 +2444,9 @@ static int timerlat_fd_open(struct inode *inode, struct file *file) > tlat = this_cpu_tmr_var(); > tlat->count = 0; > > + hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); > + tlat->timer.function = timerlat_irq; > + > migrate_enable(); > return 0; > }; > @@ -2526,9 +2529,6 @@ timerlat_fd_read(struct file *file, char __user *ubuf, size_t count, > tlat->tracing_thread = false; > tlat->kthread = current; > > - hrtimer_init(&tlat->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_PINNED_HARD); > - tlat->timer.function = timerlat_irq; > - > /* Annotate now to drift new period */ > tlat->abs_period = hrtimer_cb_get_time(&tlat->timer); >