Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp843240pxb; Wed, 15 Sep 2021 14:50:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0Jf1FRY+LOw8YqrByBefWUcYVTlz7z+tZCEOf4HEFu7agxlUPbiQVQu4ZgckMUvOKpG7L X-Received: by 2002:a6b:6c17:: with SMTP id a23mr1816958ioh.110.1631742600133; Wed, 15 Sep 2021 14:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631742600; cv=none; d=google.com; s=arc-20160816; b=Q0JN4M9k3da9OZhrVRFlOz8plAGf/hssrMlIshBSKx6weCFcDRlO/8SHSOXBzFy7RY S+404zI0wxgE6dOy3PaGKVt3CObTMsicGiqcS9MAzCLjcF77DnptRWOvzLlt73gvz5+f Kk0nvwGabC4wGHbrW68QvhWHV8h3+aAhJCUxA88zybUMaNltG5oVRWLPEx39NfjyX8tW WG8s5AAVe6PH6i/zvFGwgXf+jyFHU0sYuikVigu83hR0r8MEaiQwbQK1BidDTmIXF26q 08MZq2Xr7HcWKI8iWKVIsSBYB3Ixk/MAYKDv/zIfmxKztrhDJ3uK8JibjUd5O6mZs5Qi PnGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=sGtEv0Gt5oRcP0W6l4dwVb/oTYa7/HAxak9jvyj/Jow=; b=0qE11RqGp0btRaQiF4ep2rluCWNVyG/fGTrd0j87rsh4zLZ+8R6x5L7JjJt3Dew6Zc PO8S9ysEyEhviYTd5Et0x9RECkZqVLpGo66M3e0nPT+LycV8K3XecYofbTWZV5afqr90 ToEAVAwYbz4+Yb1mp3gsLaiXJ2RB492ZTT6pm/udxGmPINU/zWS9BJUbhNC2l7Xap+7q nKjppR6fbBxwKvypwd92lSRErTTl3/D21SL4jLTdRvoQxS5Gh7eSUhXIY13bHuGX29t2 /3Lp7to5s1/8WW2ndcLCO+vd4Js83QgcpoxZEeaK7pfkno5MLWnMUP8N1gOV7rif0JT4 k6cg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si1066701ilg.125.2021.09.15.14.49.47; Wed, 15 Sep 2021 14:50:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232465AbhIOVsl (ORCPT + 99 others); Wed, 15 Sep 2021 17:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:51196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbhIOVsj (ORCPT ); Wed, 15 Sep 2021 17:48:39 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C0C3D60EE4; Wed, 15 Sep 2021 21:47:19 +0000 (UTC) Date: Wed, 15 Sep 2021 17:47:18 -0400 From: Steven Rostedt To: Jiri Olsa Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Subject: Re: [PATCH 7/8] ftrace: Add multi direct modify interface Message-ID: <20210915174718.77acaf8b@gandalf.local.home> In-Reply-To: <20210914174134.1d8fd944@oasis.local.home> References: <20210831095017.412311-1-jolsa@kernel.org> <20210831095017.412311-8-jolsa@kernel.org> <20210914174134.1d8fd944@oasis.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 Sep 2021 17:41:34 -0400 Steven Rostedt wrote: > A better solution, that prevents having to do this, is to first change > the function fentry's to call the ftrace list loop function, that calls > the ftrace_ops list, and will call the direct call via the ops in the > loop. Have the ops->func call the new direct function (all will be > immediately affected). Update the entries, and then switch from the > loop back to the direct caller. An easy way to force the loop function to be called instead of the direct trampoline, is to register a stub ftrace_ops to each of the functions that the direct function attaches to. You can even share the hash in doing so. Having the ftrace_ops attached in the same locations as the direct trampoline, will force the loop function to be called (to call the stub ftrace_ops as well as the direct trampoline ftrace_ops helper). Then change the direct trampoline address, which will have the ftrace_ops helper use that direct trampoline immediately*. Then when you remove the ftrace_ops stub, it will update all the call sites to call the new direct trampoline directly. (*) not quite immediately, as there's no read memory barrier with the direct helper, so it may still be calling the old trampoline. But this shouldn't be an issue. If it is, then you would need to include some memory barrier synchronization. I'm curious to what the use case is for the multi direct modify interface is? -- Steve