Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp977040ybf; Fri, 28 Feb 2020 11:17:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxGS2YNVb/Ip5R/SV0h8TgykP0AYQJvnHEFDhhqLnBqZOLQuRFG3RB2wLXKVrkyMJ2ZNI4I X-Received: by 2002:aca:f405:: with SMTP id s5mr4227034oih.93.1582917468720; Fri, 28 Feb 2020 11:17:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582917468; cv=none; d=google.com; s=arc-20160816; b=aGLG7cfeOYBdn0FTCJg/UXpPxczBX/Vfe5dHj0+9hNOupfz4QR8SdR4DCFSzBolTRF vMpBUyErQvZiQxH4D4o8CLaqUrWcmYXuaUtV1xN6KpjCJrszaKvEJnJQgeHEs1+r89Cg jIlX0SgOsuQvNihF8+OARm+KtK0leYsMEYil+0GPURZ/QJChgtdO3lIUl56ZY4MaTycw oY9PFgFi18+P0ubqtAwE+MxHKqWHzB6pQV451VTQYe/Qj9zce7Gaiwa9WDP2jH4qen6H pyT+XEwVaGW0BRUbxJ9vIGtIiLwXehCIvWdLuBxQB08cNlV6YC64gpKXuqkd8b4xRalO bo0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=bUIPHr+BANkFIXYPk1gihDHcrhax9ZN2CIx23SQicco=; b=nK87qRkFOebAUeZE02kbXATiZX8gDigdbh/Z/pgVN1pdPLwbw1NTd0rK+pbNcZqFNJ s3dcWreOtDdxYAElAW5hkFq80E41adP6CCxKguByxFlB8VLu1cNKaHXocxIfO+uee3Jv cJy0vZuFdqPnMyqhMyG23LK3udDIlryXEne8PlJ7OSS+OcVliiexpZCAGeTWDTaqwYVr BeaZS0hYNhHszRAnCOvWpMhAniHA5wVL3h0ltyYaTgaYY33TV0AKNU7OepZ8+HGBP1t+ Hillo47eWEnvvZn9yMmybfGPpWXam5glsmacmxevnbwIqmSL7B4sOonr3c44/3TPLRGl GE/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x10si2150164oic.136.2020.02.28.11.17.37; Fri, 28 Feb 2020 11:17:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726788AbgB1TQ6 (ORCPT + 99 others); Fri, 28 Feb 2020 14:16:58 -0500 Received: from mga14.intel.com ([192.55.52.115]:49692 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbgB1TQ6 (ORCPT ); Fri, 28 Feb 2020 14:16:58 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2020 11:16:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,497,1574150400"; d="scan'208";a="385584427" Received: from crojewsk-mobl1.ger.corp.intel.com (HELO [10.252.14.243]) ([10.252.14.243]) by orsmga004.jf.intel.com with ESMTP; 28 Feb 2020 11:16:55 -0800 To: Steven Rostedt Cc: "linux-kernel@vger.kernel.org" From: Cezary Rojewski Subject: Question about enabling trave_events on module load Message-ID: <8107a684-3ade-2457-28e4-c7e29ab1b1f5@intel.com> Date: Fri, 28 Feb 2020 20:16:54 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Steven, I bet that is not the first time said question is asked - that's for sure - but I failed to find a method for solving the issue, that is: not missing a single trace from the moment given module is loaded. Maybe I'm missing something or documentation wasn't clear enough and that's why I'm here. If I am, please point to towards the right direction. Then you can slap me for not reading the documentation carefully. "trace_event=" cmdline option seems to target built-in tracepoints _only_ so ain't much of a help to me. After digging the past for some time, I've found a very promising thread: tracing: Enable tracepoints via module parameters https://lore.kernel.org/patchwork/patch/240185/ Sadly, I wasn't able to find _that_ solution (or anything similar for that matter) implemented into the kernel. So far, the only option I came with was separating traces into a built-in piece that declares all events upfront so "trace_event=" option has something to hook into. Said piece is of course made of a standard trace header file filled with macro usage and a .c file with handful of EXPORT_TRACEPOINT_SYMBOL(s). While that solution could suffice, localization is the problem here - if a tree my module is built in is configured via -m, the built-in piece won't expose symbols at all and 'make' will leave me with bunch of "ERROR: undefined" for every module my traces were used in. To fix the problem, I've relocated my trace .c file to /kernel/trace/. Finally it compiles and works as intended.. Not really satisfying, though. While there are some examples of subsystems keeping their trace .c in /kernel/trace (e.g.: power-traces.c), I don't believe that place is open for _every single driver_ to dump their trace sources into. If indeed traces cannot be enabled on module load, then this is a gap. While not everyone looked satisfied in the 9year old thread, I believe having the gap closed is important - and userspace can always be improved upon as time passes. Thank you in advance for your input and time. Czarek