From mboxrd@z Thu Jan 1 00:00:00 1970 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 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: 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-Google-Smtp-Source: AGHT+IFavvihRisV9kCaSJXWkP5NlMeM+2ciaavifWQ9HNV1hzqkvuSD7eRB5OdriFQR916iQBclkPwrahehtGboVyQ= 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