Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2760313lqp; Mon, 25 Mar 2024 08:29:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1/gADfxGSA09zoG+qtKrcnALjpkUjqudo7rue5XpN8dpENOJ4ZwiDsV5eiUTjsSdsxC0LfI6ggQ6jokAJ4hW36k9UqFhbeyas+4D8bQ== X-Google-Smtp-Source: AGHT+IHwJuB2JxQzHZbsExRaxX+a8y3l4sIHc6hHxIKA4+AUmOI9QVGDm/uDfwzRFUQNJXK65BNS X-Received: by 2002:ac2:5f85:0:b0:514:b450:99b4 with SMTP id r5-20020ac25f85000000b00514b45099b4mr5959047lfe.65.1711380599564; Mon, 25 Mar 2024 08:29:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711380599; cv=pass; d=google.com; s=arc-20160816; b=HoDp5F7c2xO9U1LobVmE0atqCycoRPS889MWssvLRt1oqI3dmTFTZ+Hw0AHo5/x+5q nNxKF+xrTTsIkpktBvDDPJJ36g2MDGSrlgMUKAlXdnECZKHBUfsztfGzPOsaAJfvroJm 6WNk3RsNNBLxZOZbvEPwqjh0D2CAJXG3tcO8RnLmwMS8/lqQGM3XupOu+QGqSpb6WNYD jJ73R+CBYvCyLAHygdnJnyAtFkFMuS0rM1TunQ0fVOKTTUxvo4VsVxdbupoTyGvMPgUW QbwjBiaoGb1DVfzPCZ0j0PYT0oeKJYq1pohYcAC6Jzr9IFqeeggGka/hOILnxMQuK7Fe mhpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=5RyxoVFw8iV/PhK2kQZFnetLsvcimHQCr4aKA83CIbw=; fh=pKBD85YTpLrgMyuOPlDHs10qGkGEynvOI+yqMV0HEq0=; b=o8+uOY3ExYhMfvUzf+YdO8OBZwnhBCu3zDXJiscvMeoOWsQ3NG25pXapzLFLhlAwna OpPpLLmXlWcPMBZi/zYP4GAp3s03rX1iYNCR3Jd3X3PEQ0no2ZVHL0YlM5/f7S32ClC/ 2PXy1aVVinHY0nfR1ihBfumfAD/3VU/vOzTW3V9KRyVQw0fCvLOb8eESgvgjBrBEcMF6 dM8PgkWQtyGS43q0r1jHRq03bZud9/zrMxpRg7qBeEV2wdgZ+P9nX0r3HvFHXJaIsN3g 8sTiG6O+QuEXe/kJAS14bYxuXnvMmkUrEOZDiJfEo2NkP01ee5YeUwAc0WqBX+uh2hCj OxuQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=a4TNHSkf; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-117059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117059-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a21-20020a1709064a5500b00a4729eeaaa3si2709122ejv.699.2024.03.25.08.29.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 08:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=a4TNHSkf; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-117059-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117059-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 7B0821F3FECF for ; Mon, 25 Mar 2024 15:29:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3042B71B20; Mon, 25 Mar 2024 12:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="a4TNHSkf" Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B608616B43B for ; Mon, 25 Mar 2024 12:50:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711371025; cv=none; b=Gs39fSsbyeomM5aSHHi+MUtIC27HnlcBm/DIwowVJ3N155K94ZJ+n/Nv5nxFZDfD600eyH/r5UC8Enb98fAwK0JoSZfmrQFKJQZlVZbFJiiIBbmcFyFEo55MVNHcoQszRhAnznulaaiqz2Lu5971phe80gRlIL4QDq2Od3v2oHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711371025; c=relaxed/simple; bh=5RyxoVFw8iV/PhK2kQZFnetLsvcimHQCr4aKA83CIbw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LuLtJooVEwEulmLIgehlxlPcGuCXiry46uyP3/juVlY8l7CtaMmrEHoN2/XaOnwoEhJOwIbkYY2/PZlrrIQkAWnDx/JqGDZI8JkDC0qTQ3p/fB7YXxKxvVqYzwtRh1tKO0l7XEbZf2l7ApyLZzDKVdeyH7+BhUqD5wimJ0Ws07s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=a4TNHSkf; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-5d8b519e438so2394479a12.1 for ; Mon, 25 Mar 2024 05:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1711371023; x=1711975823; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5RyxoVFw8iV/PhK2kQZFnetLsvcimHQCr4aKA83CIbw=; b=a4TNHSkf345sgU+AhOU4z07DoeTKHgfhTOtCntVFlL5JUPIJD/s/wbEYk8XiPkG5nT eRFKk/ZWgWFH2CzOAStB5sGfJQbQoRmqsv9dUgBiS9bz9s8u02qszMcDF90mG9m7JOX8 ilAaOOg16Ec8Ky13yUBtua2gFPSRhLWISNT6X4Hu23ivWGSsYc6nx2+nGOgpKk8CDD6E kSLSVTFKpttG3ROgenDsIv3lXFgwQMEnDCvKn0NJcOSePd9jovd9u3TXBMvFBRyyYBey 659DD7xK7+6xGDbySP5Z5MzwVGainNWCQtMukMKLXSFNAloigdk76z4/arVERypC4FrW YnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711371023; x=1711975823; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5RyxoVFw8iV/PhK2kQZFnetLsvcimHQCr4aKA83CIbw=; b=VDpoesLIOKH/1MXQdGw6QuRAWja2iAS53lRDqgGG2KY2E8s4yb4GENMRJHM/hnax3q m2u4cEfkGMaVJ9iXY5Xcs13YL/Qr9za/GWMizJBG06q3uHnAyQygjHiO2ieqjGen1Uvy wD5VcqEsHkX8GGjZTwXM06vEi7prlgTeKYorfACXKq0XqLN0f0SFdlVXYYFvY0vvRQw0 sZWFlF/4Gjx4ilWpj8bY3pplcm7NrZugFh/rksZjFZM8CQlmzlEQ3ZOz7vRAyZ8QnQCC k2kIRb3Yvtin8YzUudxj19Klwv8b9rjTaaJWz6Xwb4RST14FNUQZtmisPiT09bArNxz9 bibg== X-Forwarded-Encrypted: i=1; AJvYcCVk7uYfh/+aaVm4EBsop7Sw5l5Cpi7Pe2K70ZrifjmKmiTAmW8p753Q6pitmgppTvldI5PTNkZMTusR6sIpJaNwN5rkasy14Xp9tQ6s X-Gm-Message-State: AOJu0YyBF8CABMzd5OzjY+hBS12Iw+yy16b4hrAYWh2C7ilyQMWwO3st 06O1hhsiHXVgUo6+r+MdFWBy+dmvpTDN8WomqDpZf3YNwoNKigIW6HjjMI+2wDqYMyiEvl78nSa IEODFBFB8Pm5oDjPvB/4bFEoFswKYGdktH9fJIg== X-Received: by 2002:a17:90a:b30c:b0:29c:5c56:ffea with SMTP id d12-20020a17090ab30c00b0029c5c56ffeamr4730905pjr.6.1711371023055; Mon, 25 Mar 2024 05:50:23 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240306165904.108141-1-puranjay12@gmail.com> <87ttlhdeqb.fsf@all.your.base.are.belong.to.us> <8734suqsth.fsf@all.your.base.are.belong.to.us> <87zfv0onre.fsf@all.your.base.are.belong.to.us> <87il1oedx8.fsf@all.your.base.are.belong.to.us> <87msqsotr8.fsf@all.your.base.are.belong.to.us> In-Reply-To: From: Robbin Ehn Date: Mon, 25 Mar 2024 13:50:11 +0100 Message-ID: Subject: Re: [RFC PATCH] riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS To: Andy Chiu Cc: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Puranjay Mohan , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Steven Rostedt , Masami Hiramatsu , Sami Tolvanen , Guo Ren , Ley Foon Tan , Deepak Gupta , Sia Jee Heng , Bjorn Topel , Song Shuai , "Cl'ement L'eger" , Al Viro , Jisheng Zhang , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, Brendan Sweeney Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey, > > func_symbol: > auipc t0, common_dispatch:high <=3D> j actual_func: > jalr t0, common_dispatch:low(t0) > If you are patching in a jump, I don't see why you wouldn't jump over ld+jalr? (no need for common dispatch) Patching jalr with nop, and keeping auipc, addresses the issue with having to jump in the disabled case. But needs either common dispatch or per func dispatch. Thanks, Robbin > common_dispatch: > load t1, index + dispatch-list > ld t1, 0(t1) > jr t1 > > > > > > > However, one thing I am not very sure is: do we need a destination > > > address in a "per-function" manner? It seems like most of the time th= e > > > destination address can only be ftrace_call, or ftrace_regs_call. If > > > the number of destination addresses is very few, then we could > > > potentially reduce the size of > > > . > > > > Yes, we do need a per-function manner. BPF, e.g., uses > > dynamically/JIT:ed trampolines/targets. > > > > > > > > Bj=C3=B6rn > > Cheers, > Andy