Message ID | 7324dd3fc0035658c99b825204a66049389c56e3.1706798888.git.bristot@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-48368-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp221824dyb; Thu, 1 Feb 2024 07:14:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFDlkG84OZR94UcCE7yz82sGKYtcTYxcXNBKkOEUFpmF/z2GcJDCMRdeeFs2nrKmnETJamj X-Received: by 2002:ac8:4e4d:0:b0:42b:f8ea:7851 with SMTP id e13-20020ac84e4d000000b0042bf8ea7851mr1504619qtw.8.1706800447224; Thu, 01 Feb 2024 07:14:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706800447; cv=pass; d=google.com; s=arc-20160816; b=SAWqP0Ef8kVWsoJun5t5qArfXaICcr6aPFdpQ5Bjh0BzRXOy4456fjkCYdbRGJ4VJi 8oZvabH8tcKZ0w9cabf6/mKXqvlVy/7+pmJ7/Dj8P93nt+L2mJmemURc/VJL0tYY2n1i kqGOBi2UQuPK3MT0Oiriw8QrcQhDz9GSxSkJESeZ5+icYyXQtHOVqIAjowCKY1q8+Ppu fZg4x183cZLKial4VzYw0Hx7Ccb6Ff7n+F8TD6nko7h8yoVaNrPS52zUXtcAbnAma9Tf RPXNNbrAN2HGNE+8E9kP6PlglKEIZRWoat4saz3huUSsog9aKfbdZamEXkPfr0LfNqzJ zhOw== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=PW8LtK3eLbT+R6BUiYkc31jj/KAv643Uqyz0nvPLHqs=; fh=zKBw7DDJsd8YMISMEdRGhIgGZei5NitmZsBKURm6Qaw=; b=lkwnvDrxe4UeVYftguH5O40AA/D2ur8MwoI2vo/xsqDeXvuHqtg/Hmdr0LJgW4fQA1 5tfsLTZEBzYNljvTnSi/DFm7VPM/AcG2LRJp8zNLO9GhGfp3iWSc5Ov5ukQOkRf2bwgi jiRflR3DhZqdLnaDxswtr8kG7iqDLe/LTxbnMxsylAiWAG4FT5X5nG85oiAbPFUttpMW f4sqKevmHkeCknY3uu+sJvIypZrVbQP5FlBnbfuUTGS+fI6Yzy7fcOpxE9adlXFh1iAI Ng1RguRZ4UQ0WECWYOQINt9CJOBep4MlPx4O+/hFz/fQmt77uBJB126XSzN4BG/wjo0p NDvg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WwRdsEgn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48368-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48368-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXsY1Evef3kRAnQwNMTFGXjzWGuw05NzyjqisYen9hYq5NC5xCGYv6VZCZss4tS3tSD1SCwF7+yU874UYGDmWYAxTzMPQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h16-20020ac87d50000000b0042ab48ceefesi6356652qtb.442.2024.02.01.07.14.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:14:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48368-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WwRdsEgn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48368-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48368-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 073BB1C26083 for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 15:14:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E134662161; Thu, 1 Feb 2024 15:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WwRdsEgn" 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 2A43E5F49E; Thu, 1 Feb 2024 15:13:49 +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=1706800430; cv=none; b=fFWik2sO5Ogu1H7jwMJKSNdUQu9p3/NFL68P0WfyREhIk1+tkmQV5G1y0tJwL16+N9z/HOUB8Ci7Ht/YuGTig/bHyqbhZGSWpX86Op0QdkAutWB6sshOkrBNwWCk5c5bIfiygQbXBSMRLVHQk9tot67msBDH+3bdfxKg2P514l4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706800430; c=relaxed/simple; bh=J25LSF02c3Gihi6ywJToP8/0dpuIX20uFfdRTlYxyRg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Giya0wkA4NM5SBmK7pVoD+r/vzGsxxAsMEqCA0OV+241RwzkKQdtEsgwoLPYw9IK5kTdaugCAdatSqjr4odZWRMma9ajh4/t9q+5xHHoKAyM9mrtaHVDTer7UykelmbE2iHNTXPmlYgIe0We8F4nyxaP4Tq5COt1w21bW3yZUfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WwRdsEgn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F423DC433F1; Thu, 1 Feb 2024 15:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706800429; bh=J25LSF02c3Gihi6ywJToP8/0dpuIX20uFfdRTlYxyRg=; h=From:To:Cc:Subject:Date:From; b=WwRdsEgnfVREwIGEX7L2Y0qvFc4a+QOfttbXdf6t8ZoZNJqEAF6ntKisAF9lamz/c CKCOXaJCB1NwUOAuFSWq5OWNXl4pXVdZJnYhNcZuW8JGTQ8u0Z4Sosso2c5GgnCgPB 7dR5pfRAW6HrAqvmWuJCBnh6Y5X0kIVJ/KhHUPFuPT9K03GqVRjJtfGP6m6hNgbZP2 X3Sn7bLvYa98cxeGVu0bS+gecxyjnBFLZlorUBZQDP2GS/v+EMk8hjl0Evn3X1dB5N EIKY1bGR+sRwskTDZMEvuuAvwRImAxta9NDT3WI6wbIW8tPUXCNpYlze1Q51t/tRyl 8tmRRAUrucKXg== From: Daniel Bristot de Oliveira <bristot@kernel.org> To: Steven Rostedt <rostedt@goodmis.org> Cc: Daniel Bristot de Oliveira <bristot@kernel.org>, Masami Hiramatsu <mhiramat@kernel.org>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] tracing/timerlat: Move hrtimer_init to timerlat_fd open() Date: Thu, 1 Feb 2024 16:13:39 +0100 Message-ID: <7324dd3fc0035658c99b825204a66049389c56e3.1706798888.git.bristot@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789709985994788580 X-GMAIL-MSGID: 1789709985994788580 |
Series |
tracing/timerlat: Move hrtimer_init to timerlat_fd open()
|
|
Commit Message
Daniel Bristot de Oliveira
Feb. 1, 2024, 3:13 p.m. UTC
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.
Fixes: e88ed227f639 ("tracing/timerlat: Add user-space interface")
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
kernel/trace/trace_osnoise.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 2/1/24 16:25, Steven Rostedt wrote: > On Thu, 1 Feb 2024 16:13:39 +0100 > Daniel Bristot de Oliveira <bristot@kernel.org> 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. ok >> >> 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? right, I added it on Cc, but did not include the Cc:.. tag. It seems that I should have. -- Daniel > -- Steve > > >> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org> >> --- >> 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); >> >
On Thu, Feb 01, 2024 at 04:13:39PM +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. What error exactly happens? Userspace, or the kernel crashes? thanks, greg k-h
On 2/1/24 16:44, Greg KH wrote: > On Thu, Feb 01, 2024 at 04:13:39PM +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. > > What error exactly happens? Userspace, or the kernel crashes? sorry, kernel crash: # echo NO_OSNOISE_WORKLOAD > /sys/kernel/debug/tracing/osnoise/options # echo timerlat > /sys/kernel/debug/tracing/current_tracer # cat ./timerlat_load.py #!/usr/bin/env python3 timerlat_fd = open("/sys/kernel/tracing/osnoise/per_cpu/cpu0/timerlat_fd", 'r') timerlat_fd.close(); # ./taskset -c 0 ./timerlat_load.py <BOOM> [ 6401.611374] BUG: kernel NULL pointer dereference, address: 0000000000000010 [ 6401.611786] #PF: supervisor read access in kernel mode [ 6401.612081] #PF: error_code(0x0000) - not-present page [ 6401.612376] PGD 0 P4D 0 [ 6401.612495] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 6401.612690] CPU: 1 PID: 2673 Comm: python3 Not tainted 6.6.13-200.fc39.x86_64 #1 [ 6401.613011] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-1.fc39 04/01/2014 [ 6401.613379] RIP: 0010:hrtimer_active+0xd/0x50 [ 6401.613577] Code: 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 57 30 <8b> 42 10 a8 01 74 09 f3 90 8b 42 10 a8 01 75 f7 80 7f 38 00 75 1d [ 6401.614374] RSP: 0018:ffffb031009b7e10 EFLAGS: 00010286 [ 6401.614604] RAX: 000000000002db00 RBX: ffff9118f786db08 RCX: 0000000000000000 [ 6401.614914] RDX: 0000000000000000 RSI: ffff9117a0e64400 RDI: ffff9118f786db08 [ 6401.615225] RBP: ffff9118f786db80 R08: ffff9117a0ddd420 R09: ffff9117804d4f70 [ 6401.615534] R10: 0000000000000000 R11: 0000000000000000 R12: ffff9118f786db08 [ 6401.615846] R13: ffff91178fdd5e20 R14: ffff9117840978c0 R15: 0000000000000000 [ 6401.616157] FS: 00007f2ffbab1740(0000) GS:ffff9118f7840000(0000) knlGS:0000000000000000 [ 6401.616508] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 6401.616765] CR2: 0000000000000010 CR3: 00000001b402e000 CR4: 0000000000750ee0 [ 6401.617075] PKRU: 55555554 [ 6401.617197] Call Trace: [ 6401.617309] <TASK> [ 6401.617407] ? __die+0x23/0x70 [ 6401.617548] ? page_fault_oops+0x171/0x4e0 [ 6401.617983] ? srso_alias_return_thunk+0x5/0x7f [ 6401.618389] ? avc_has_extended_perms+0x237/0x520 [ 6401.618800] ? exc_page_fault+0x7f/0x180 [ 6401.619176] ? asm_exc_page_fault+0x26/0x30 [ 6401.619563] ? hrtimer_active+0xd/0x50 [ 6401.619926] hrtimer_cancel+0x15/0x40 [ 6401.620286] timerlat_fd_release+0x48/0xe0 [ 6401.620666] __fput+0xf5/0x290 [ 6401.621004] __x64_sys_close+0x3d/0x80 [ 6401.621370] do_syscall_64+0x60/0x90 [ 6401.621730] ? srso_alias_return_thunk+0x5/0x7f [ 6401.622129] ? __x64_sys_ioctl+0x72/0xd0 [ 6401.622503] ? srso_alias_return_thunk+0x5/0x7f [ 6401.622902] ? syscall_exit_to_user_mode+0x2b/0x40 [ 6401.623309] ? srso_alias_return_thunk+0x5/0x7f [ 6401.623703] ? do_syscall_64+0x6c/0x90 [ 6401.624063] ? srso_alias_return_thunk+0x5/0x7f [ 6401.624457] ? exit_to_user_mode_prepare+0x142/0x1f0 [ 6401.624868] ? srso_alias_return_thunk+0x5/0x7f [ 6401.625262] ? syscall_exit_to_user_mode+0x2b/0x40 [ 6401.625663] ? srso_alias_return_thunk+0x5/0x7f [ 6401.626051] ? do_syscall_64+0x6c/0x90 [ 6401.626404] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 [ 6401.626810] RIP: 0033:0x7f2ffb321594 [ 6401.627164] Code: 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 80 3d d5 cd 0d 00 00 74 13 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 3c c3 0f 1f 00 55 48 89 e5 48 83 ec 10 89 7d [ 6401.628345] RSP: 002b:00007ffe8d8eef18 EFLAGS: 00000202 ORIG_RAX: 0000000000000003 [ 6401.628867] RAX: ffffffffffffffda RBX: 00007f2ffba4e668 RCX: 00007f2ffb321594 [ 6401.629372] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 [ 6401.629879] RBP: 00007ffe8d8eef40 R08: 0000000000000000 R09: 0000000000000000 [ 6401.630384] R10: 55c926e3167eae79 R11: 0000000000000202 R12: 0000000000000003 [ 6401.630889] R13: 00007ffe8d8ef030 R14: 0000000000000000 R15: 00007f2ffba4e668 [ 6401.631394] </TASK> [ 6401.631691] Modules linked in: tls nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr sunrpc pktcdvd intel_rapl_msr snd_hda_codec_generic intel_rapl_common ledtrig_audio snd_hda_intel snd_intel_dspcfg snd_intel_sdw_acpi snd_hda_codec snd_hda_core snd_hwdep snd_pcm kvm_amd iTCO_wdt snd_timer intel_pmc_bxt ccp joydev iTCO_vendor_support kvm irqbypass i2c_i801 snd i2c_smbus soundcore lpc_ich virtio_balloon loop zram crct10dif_pclmul crc32_pclmul crc32c_intel polyval_clmulni polyval_generic ghash_clmulni_intel sha512_ssse3 sha256_ssse3 sha1_ssse3 virtio_net virtio_gpu virtio_console virtio_blk net_failover failover virtio_dma_buf serio_raw scsi_dh_rdac scsi_dh_emc scsi_dh_alua fuse dm_multipath qemu_fw_cfg [ 6401.636126] CR2: 0000000000000010 [ 6401.636482] ---[ end trace 0000000000000000 ]--- [ 6401.636891] RIP: 0010:hrtimer_active+0xd/0x50 [ 6401.637288] Code: 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 0f 1f 44 00 00 48 8b 57 30 <8b> 42 10 a8 01 74 09 f3 90 8b 42 10 a8 01 75 f7 80 7f 38 00 75 1d [ 6401.638507] RSP: 0018:ffffb031009b7e10 EFLAGS: 00010286 [ 6401.638951] RAX: 000000000002db00 RBX: ffff9118f786db08 RCX: 0000000000000000 [ 6401.639478] RDX: 0000000000000000 RSI: ffff9117a0e64400 RDI: ffff9118f786db08 [ 6401.640005] RBP: ffff9118f786db80 R08: ffff9117a0ddd420 R09: ffff9117804d4f70 [ 6401.640535] R10: 0000000000000000 R11: 0000000000000000 R12: ffff9118f786db08 [ 6401.641067] R13: ffff91178fdd5e20 R14: ffff9117840978c0 R15: 0000000000000000 [ 6401.641601] FS: 00007f2ffbab1740(0000) GS:ffff9118f7840000(0000) knlGS:0000000000000000 [ 6401.642174] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 6401.642653] CR2: 0000000000000010 CR3: 00000001b402e000 CR4: 0000000000750ee0 [ 6401.643193] PKRU: 55555554 [ 6401.643548] note: python3[2673] exited with irqs disabled -- Daniel > thanks, > > greg k-h
On Thu, Feb 01, 2024 at 05:02:56PM +0100, Daniel Bristot de Oliveira wrote: > On 2/1/24 16:44, Greg KH wrote: > > On Thu, Feb 01, 2024 at 04:13:39PM +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. > > > > What error exactly happens? Userspace, or the kernel crashes? > > sorry, kernel crash: > > # echo NO_OSNOISE_WORKLOAD > /sys/kernel/debug/tracing/osnoise/options > # echo timerlat > /sys/kernel/debug/tracing/current_tracer > > # cat ./timerlat_load.py > #!/usr/bin/env python3 > > timerlat_fd = open("/sys/kernel/tracing/osnoise/per_cpu/cpu0/timerlat_fd", 'r') > timerlat_fd.close(); > > # ./taskset -c 0 ./timerlat_load.py > <BOOM> Then obviously, this is a real, functional, change, so say so in the kernel changelog :) thanks, greg k-h
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);