Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp129529lqb; Thu, 14 Mar 2024 07:16:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXjC6cPJzw7B9lbmKtPozXKvxQTgt4Wx7IPzGIAUYTFDL9DCystWvbBiSRcib64SEDLR0Vtnl4nNm+Mx5XRSKLWXajH/M/Uf9QwQ+fqjg== X-Google-Smtp-Source: AGHT+IH7JVgLx8tmJLDQ1ZPo/RweYs8hMjPCPOdi4Wcl/TB5HLEGp12LGzsWkPdqFCa4+0cH5sq4 X-Received: by 2002:a0c:ab0f:0:b0:690:96d0:a2ce with SMTP id h15-20020a0cab0f000000b0069096d0a2cemr1595189qvb.65.1710425808392; Thu, 14 Mar 2024 07:16:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710425808; cv=pass; d=google.com; s=arc-20160816; b=L1d3NqV18JkomWWmd6+Bklc0r6CmNXJlnPPUJ0atVT29rkrPa0YcXNrbK5zoY2Sz88 t72NPgvevJB0UutS+LREJG2hxy/8snthJURdpjah5nLsoKBMTKfIpgAZ2i9LyAMhn0iD 3hidvsSmkGVJWKi0GbC4L9Zv8O/NZlPlwQ3YyQMMpz1n++qvp5jC5k4YL+Ke6QX7dMe9 NBHyW2GibEB1jG4tAhn/GDXX9yhB3kLqeqZ5+t6ScqirAYKy0wnH+0cZJxg9YU3wWd3e 3n+1yZaw4PBJidkMjCHZHU2uGUdIseKYC85dVwi9DlkX/28RBXvENgTAfL1vtwUWjfid 1t0Q== 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:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=bVGU/1nT0H0Si6zm/Sz0XZCYeGIcHvVz6AxiepPYAXg=; fh=2xIEFG/JSTI/3tf2YwLitqliJLXXEGJo+Ki6yr/jSqA=; b=tzwhCOJJIlqWUrYfY0YioS83E1+AAwTbFVRE8tP1KdV3ZiKZraKnmwRU7BkyfdCW4n sl8YeCjVhnKEHabLga21LA81fHCtg+gejeVmUpDVAVNxPN9rZzMDn3vZR68KUDXndBX5 J3fbrf3xVZIHDyIQLe+B+w16XVjuP72E+ZaRkT+/x+rLC5d5Q2dKYDmMJU5/TIK7+WJu /frbsZnlW/p4tK8tGMgaUoR66mT1bNHswMi6Sp1mFTpD766PQ8GQ9rzRfgZzlPIngeex gdSZOLigWKJJaJcbc8k9MkjrQJCDf2nUl3roHLHvk0bR0ld+tvh/gsP2tBs2foTqx7g6 9vOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HiXDBHTz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-103372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 14-20020a05621420ce00b00690c80b5da4si715144qve.140.2024.03.14.07.16.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 07:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103372-linux.lists.archive=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=@gmail.com header.s=20230601 header.b=HiXDBHTz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-103372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 7965C1C215D9 for ; Thu, 14 Mar 2024 14:16:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C5AB6FE0D; Thu, 14 Mar 2024 14:16:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HiXDBHTz" Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (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 1C9CA6FE02; Thu, 14 Mar 2024 14:16:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710425771; cv=none; b=t4+o8/lB+o14O5d7kLv+tVHclPT1Qwe/TN//GAyMdIGXf4cQ8eUdgDQ/qYHB0PajBcd7opi41lPKTRxkW+6Cu1uN2lRcQrbkqG0GfkJ4qWwLKCs2QPK4K1v0TGTJlCSRWTND8QnMHYQl+s8aHDGIR2i2nBlkvHuHIGQewcM7kxw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710425771; c=relaxed/simple; bh=bVGU/1nT0H0Si6zm/Sz0XZCYeGIcHvVz6AxiepPYAXg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=VGTKsUUtOObEJTRL2ubJb35Y46MUcT2tEuIK64KdXB0fhGkyNpzxe5+Ck2XsbN5qp2lYU5WeTblIHbJhzLrEjIpfNH4agqLSi9Opb164y1RndE1vXflVOvhb4U3VV+aINgavzV/BUfKlYUjwGW5x+IEP0pOPmUSmlPMQv0YQUAQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HiXDBHTz; arc=none smtp.client-ip=209.85.219.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-68f41af71ebso7812286d6.1; Thu, 14 Mar 2024 07:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710425769; x=1711030569; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=bVGU/1nT0H0Si6zm/Sz0XZCYeGIcHvVz6AxiepPYAXg=; b=HiXDBHTzuwviFWvMBfXKXl/R5Uklrh4zWYXcF6Ie9rjblyrSTYDFnXKL6XZ6U6sxe7 sBh5iMEubWBz2y/JP0iOZuJpAatn7G/W5QoSv8BpaCnarKssRV+wSxq37DZIuzaI8bi3 YVenQird21t52bWnugumgFCiTNx9ygeMB7RjwOnsfuef8LWlyecRAKDaAnjy5BhHM9XJ iUGahEk+247jP9qydMz+jSdmJe5+Kb9wXFZdi4wJw26Xzb9O/n9QzTEXbvQam0JPDWCC QP4ibKT1U2OdHEht86l3Lc1Qz/qykMjyOsfa9Ai7dItSYEflx4RErvLUm8QA42ornb1Y OORQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710425769; x=1711030569; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bVGU/1nT0H0Si6zm/Sz0XZCYeGIcHvVz6AxiepPYAXg=; b=eIxLMwHxFduIFtTQ9YuXv+yUFLS7caH6rH4fuVeeO3QDiCMg1UV5s3rxxSv2Rubn+o okNLikKnSFPzqdagfHHjUFr3M2Bd75HQMmWwb4PJ0L1ATTDZ3/vbqzbkeoEinYLI12Si fcah1+cYfzU5DSXNao0ei36u01gSwMEEfHH1XO+YZKACRvchID/e+QDaQeEQYu0rJHj1 W8aEZcJp34pnKBNdpUUj3vr8Qs+K3Q/6FbmP88germkOQNEPaSyI6JQvWp3AXP1raDuJ KWisg74SPXPVxN5dzXshyEqqX2U2F7OPPAnW5IL1AqUFedbWV16L4oxy9U9j5Rqh+Y62 pAeg== X-Forwarded-Encrypted: i=1; AJvYcCXCbB/JMJvhH4iFxpvBeERCfQmZ2nFDP9U5tS5mxHkBHLwpya1B6UT5fy9QZFC1Ul+XnyTpc80sKcTsHHfMnm12r/l3nldgPwVmSTGbRfsJ10ikizmEVFrfGLxWZzR8i4MD2nnuL+pKQ5OoEl3kFhLU X-Gm-Message-State: AOJu0Yx4+QqaBkDrfwSjBlhrkY9emcX4Tb5ALnDw28xwqMkLB1PVuMOA ohCsHIHNl9D7kMR0ePfFJCc2RvFsqDbNQskgiq/TJFBNnwzREGMR X-Received: by 2002:a05:6214:2e11:b0:690:de5f:2127 with SMTP id mx17-20020a0562142e1100b00690de5f2127mr1939361qvb.36.1710425768813; Thu, 14 Mar 2024 07:16:08 -0700 (PDT) Received: from localhost (54-240-197-231.amazon.com. [54.240.197.231]) by smtp.gmail.com with ESMTPSA id jx5-20020a0562142b0500b0068f4520e42dsm507705qvb.16.2024.03.14.07.16.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2024 07:16:08 -0700 (PDT) From: Puranjay Mohan To: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Mark Rutland Cc: 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, Andy Chiu Subject: Re: [RFC PATCH] riscv: Implement HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS In-Reply-To: <8734suqsth.fsf@all.your.base.are.belong.to.us> 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> Date: Thu, 14 Mar 2024 14:16:04 +0000 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Bj=C3=B6rn T=C3=B6pel writes: > > Hmm, depending on RISC-V's CMODX path, the pro/cons CALL_OPS vs dynamic > trampolines changes quite a bit. > > The more I look at the pains of patching two instruction ("split > immediates"), the better "patch data" + one insn patching look. I was looking at how dynamic trampolines would be implemented for RISC-V. With CALL-OPS we need to patch the auipc+jalr at function entry only, the ops pointer above the function can be patched atomically. With a dynamic trampoline we need a auipc+jalr pair at function entry to ju= mp to the trampoline and then another auipc+jalr pair to jump from trampoline = to ops->func. When the ops->func is modified, we would need to update the auipc+jalr at in the trampoline. So, I am not sure how to move forward here, CALL-OPS or Dynamic trampolines? Thanks, Puranjay