Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp792189ybp; Wed, 9 Oct 2019 04:26:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrhKZ3RQ+xoaCXFk3ceAWTHeF21IZtNMBk7JjiFu3P0P33tugciSA1/EtasN0zF461Tqcf X-Received: by 2002:aa7:cfcd:: with SMTP id r13mr2474202edy.146.1570620361385; Wed, 09 Oct 2019 04:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570620361; cv=none; d=google.com; s=arc-20160816; b=Gvoi0nmlQY7n4WgL2M9lfcF59Av/JljndanJhL4FUK9pgCByXz5N75T/QBcOTqntSE J62/wCexfdgK5Xi0TwYLUQcxP5WPSTA3h+MTEyOG6/GnXbUpkgWTvnn96nWcYliDv5vh 99UjbEarOKRoOO/ss3+eS7KSpU7za7sUpvkCBnvdE1uQGJGZKKxv6MCWaU2z8IUql80V WMPDg8er8pXZ/MWBasfpiYacOjZU1yEn+aEql8drhIwS7DLr7F2lPMCr3zWRed9c+qMk uAexmLOMwrqyAWMZMu207smzvqIIHpV/Dw5B4G+lY+pAHWd0cwjJ6ZeJUQJXo2bHz7Ec lIcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ILRa18dXAmVfNkv0khMhgs+SQMyr1A3KMKl4Y0nctBo=; b=RdEfHCQss5RzYAVxLipjWhEFa+EKkSYHH6MtQBi2XNWf7xDp+FgJ2QnQoS8Zf/j86T tAY5QBQFSgy4snXOfhLCmcntD3uydJMH3AgE53Ycry+9VFgp7fVt1AGI4+uzxYP2Xxx5 sGkaxNdYbSAeX8Nwkf4NIFTaTcO3xWa8St9TCC53j/cnEqwcHX3P/fDF2FXmoyVn6kmv Aotx9cIydhxT+qfEpGRDXy4Q4hS/rKkkatCI70sbn7XO72pN5K8g2xUJjnCrZ70MMCXK gfT5OXg1jf7UP8Ur3Ui8c2yYJavKAPKK/j4uftBp+2ykb5tVaP7NFYDN3mo7RfY9vnov y8Ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w14si1055651edx.197.2019.10.09.04.25.38; Wed, 09 Oct 2019 04:26:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730857AbfJILWh (ORCPT + 99 others); Wed, 9 Oct 2019 07:22:37 -0400 Received: from mx2.suse.de ([195.135.220.15]:36574 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727219AbfJILWg (ORCPT ); Wed, 9 Oct 2019 07:22:36 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AF103AF05; Wed, 9 Oct 2019 11:22:34 +0000 (UTC) Date: Wed, 9 Oct 2019 13:22:34 +0200 From: Petr Mladek To: Joe Lawrence Cc: Miroslav Benes , rostedt@goodmis.org, jikos@kernel.org, jpoimboe@redhat.com, mingo@redhat.com, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH 0/3] ftrace: Introduce PERMANENT ftrace_ops flag Message-ID: <20191009112234.bi7lvp4pvmna26vz@pathway.suse.cz> References: <20191007081714.20259-1-mbenes@suse.cz> <20191008193534.GA16675@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191008193534.GA16675@redhat.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2019-10-08 15:35:34, Joe Lawrence wrote: > On Mon, Oct 07, 2019 at 10:17:11AM +0200, Miroslav Benes wrote: > > Livepatch uses ftrace for redirection to new patched functions. It is > > thus directly affected by ftrace sysctl knobs such as ftrace_enabled. > > Setting ftrace_enabled to 0 also disables all live patched functions. It > > is not a problem per se, because only administrator can set sysctl > > values, but it still may be surprising. > > > > Introduce PERMANENT ftrace_ops flag to amend this. If the > > FTRACE_OPS_FL_PERMANENT is set, the tracing of the function is not > > disabled. Such ftrace_ops can still be unregistered in a standard way. > > > > The patch set passes ftrace and livepatch kselftests. > > > > Miroslav Benes (3): > > ftrace: Make test_rec_ops_needs_regs() generic > > ftrace: Introduce PERMANENT ftrace_ops flag > > livepatch: Use FTRACE_OPS_FL_PERMANENT > > > > Documentation/trace/ftrace-uses.rst | 6 ++++ > > Documentation/trace/ftrace.rst | 2 ++ > > include/linux/ftrace.h | 8 +++-- > > kernel/livepatch/patch.c | 3 +- > > kernel/trace/ftrace.c | 47 ++++++++++++++++++++++++----- > > 5 files changed, 55 insertions(+), 11 deletions(-) > > > > -- > > 2.23.0 > > > > Hi Miroslav, > > I wonder if the opposite would be more intuitive: when ftrace_enabled is > not set, don't allow livepatches to register ftrace filters and > likewise, don't allow ftrace_enabled to be unset if any livepatches are > already registered. I guess you could make an argument either way, but > just offering another option. Perhaps livepatches should follow similar > behavior of other ftrace clients (like perf probes?) I am not sure that I understand it correctly. ftrace_enables is a global flag. My expectation is that it can be manipulated at any time. But it should affect only ftrace handlers without FTRACE_OPS_FL_PERMANENT flag. By other words, the handlers with FTRACE_OPS_FL_PERMANENT flag and only these handlers should ignore the global flag. To be even more precise. If a function has registered more ftrace handlers then the global ftrace_enable setting shold affect only the handlers without the flag. Is this the plan, please? Best Regards, Petr