From patchwork Thu May 5 16:06:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Bristot de Oliveira X-Patchwork-Id: 12839732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29BF8C4332F for ; Thu, 5 May 2022 16:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381714AbiEEQL2 (ORCPT ); Thu, 5 May 2022 12:11:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381697AbiEEQLZ (ORCPT ); Thu, 5 May 2022 12:11:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C4215C745; Thu, 5 May 2022 09:07:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0AC8FB82DBE; Thu, 5 May 2022 16:07:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 151E8C385A8; Thu, 5 May 2022 16:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651766861; bh=uDbclZhgqhx0QL4By9pJc3Jzd8GIvN7PTG7LpVWu7HY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eTD+oTOaNBYLtovcmyO8QpUWPKJ1igybemX2o5iywsEk8cx1PvRK865WsgtmXKjUB dRGs1rZsqrVJ3VSTWC1XWklwXTl/2SzQ3u2Kk3ahqtDehDpohsM0Xnh2/Sh/XaYeff Ej89q6WEYdC/X52DPDtgwOVzBi1+h1eAsq09DtPaNQnL7wVjHeGrAo+oouKBbhE+2/ eKzstuf0OAfL2DDKZnCZb3d3r7Y3/tKXU2bRZ2xs5zMVjyQ/pTy7ra0ZWu5lgzfc9x 4zoU5z8nVCmBQVc+f2S9mr48XDkPnDUABxhEixS3JycXowB3lNQmj3AEyKx7Lod8WS X41/+wEvE4DTA== From: Daniel Bristot de Oliveira To: Steven Rostedt , linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Jonathan Corbet , Ingo Molnar , Thomas Gleixner , Peter Zijlstra , Will Deacon , Catalin Marinas , Marco Elver , Dmitry Vyukov , "Paul E. McKenney" , Shuah Khan , Gabriele Paoloni , Juri Lelli , Clark Williams , linux-doc@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: [RFC V3 05/20] rv/include: Add instrumentation helper functions Date: Thu, 5 May 2022 18:06:45 +0200 Message-Id: <8da3a74fee3b9e570065eff2382e811c1870f7d5.1651766361.git.bristot@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Instrumentation helper functions to facilitate the instrumentation of auto-generated RV monitors create by dot2k. Cc: Jonathan Corbet Cc: Steven Rostedt Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Will Deacon Cc: Catalin Marinas Cc: Marco Elver Cc: Dmitry Vyukov Cc: "Paul E. McKenney" Cc: Shuah Khan Cc: Gabriele Paoloni Cc: Juri Lelli Cc: Clark Williams Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-trace-devel@vger.kernel.org Signed-off-by: Daniel Bristot de Oliveira --- include/rv/instrumentation.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 include/rv/instrumentation.h diff --git a/include/rv/instrumentation.h b/include/rv/instrumentation.h new file mode 100644 index 000000000000..88dd33f10827 --- /dev/null +++ b/include/rv/instrumentation.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Helper functions to facilitate the instrumentation of auto-generated + * RV monitors create by dot2k. + * + * The dot2k tool is available at tools/tracing/rv/dot2/ + * + * Copyright (C) 2019-2022 Daniel Bristot de Oliveira + */ + +#include + +#define rv_attach_trace_probe(monitor, tp, rv_handler) \ + do { \ + check_trace_callback_type_##tp(rv_handler); \ + WARN_ONCE(register_trace_##tp(rv_handler, NULL), \ + "fail attaching " #monitor " " #tp "handler"); \ + } while (0) + +#define rv_detach_trace_probe(monitor, tp, rv_handler) \ + do { \ + unregister_trace_##tp(rv_handler, NULL); \ + } while (0)