Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5536132ybp; Tue, 15 Oct 2019 00:46:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwG1rWga4VKYZEGRmu27N8x9fnHnVGjbIM1YIbydf/fqWh9L1HIHKo69R6tYQh1bRl+iX5T X-Received: by 2002:a17:906:3f87:: with SMTP id b7mr32285074ejj.107.1571125617747; Tue, 15 Oct 2019 00:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571125617; cv=none; d=google.com; s=arc-20160816; b=XkUVz4tokedNFQaqWOj5l9gWvgb2XUCUz3kcYmjXj9XeQU2ZnzWWlTgUmE3PVXmPfZ 5UwyZNFCGYD0TM73MtbrQ+XhoDr837vzGulk35/x9sp1YvGqbv6HqDavGgd7GRSzn/vC NREL736jzUQj4qrIb4WYm369Ucifv/ZBX56l6SoSrxiHpI2WEMGn4DF4SpXisRTTUvmy /pcQFAZwdyDpK7pPypj+d+0NGkEpptk3Z30M/SA52QrUngcZ2cJl0t0Y0rz1K6DkeS6L Z/mByFd5nYvxUOIR/L2rJAajSvbWYludRfuyyRVC11S6vZkJRSpseDSXetCuQ+gzh6Q0 sgPw== 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=db+9c1aFh8Exe0fNyUNz3nJ6bgQTHAMCI6DwXn2hSw0=; b=qmaiORebTPU7wuSJ/bOxwzHfo+PZIsnUakKJGmTREs7mt4TETo6o4NFzfAk/2w6WFF EvxZOPpgOhjbM1t454f+TLwi/DILiEGroI6qRrM6Rvsv3s2LgbQEmwEcyzmi19TanV1j 8+FWwoMupfmtsqDIsQFbmhLn/fDbz2nEIA0rV+38oYvVq2z5n+DFXc6SYBExs7CR5b2/ sXQYsYapEVsXcELcYcvYkHpMhG/kJy0jUbrCq2vGFbIJryn/QMr7GI3s3lm9e9VFPDz9 DAxPG0SrxRVZFsvdFhOwp7oSTAesNUk049Qu5MZspJG4xmaR2nFYjpeX7VMDlyFSAMkf 34/Q== 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 u14si12639993edq.167.2019.10.15.00.46.34; Tue, 15 Oct 2019 00:46:57 -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 S1728045AbfJOHpn (ORCPT + 99 others); Tue, 15 Oct 2019 03:45:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:44420 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727451AbfJOHpm (ORCPT ); Tue, 15 Oct 2019 03:45:42 -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 CB419AC59; Tue, 15 Oct 2019 07:45:40 +0000 (UTC) Date: Tue, 15 Oct 2019 09:45:40 +0200 From: Petr Mladek To: Steven Rostedt Cc: Miroslav Benes , jikos@kernel.org, joe.lawrence@redhat.com, jpoimboe@redhat.com, mingo@redhat.com, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org Subject: Re: [PATCH v2] ftrace: Introduce PERMANENT ftrace_ops flag Message-ID: <20191015074540.bxehllisibls3kk7@pathway.suse.cz> References: <20191014105923.29607-1-mbenes@suse.cz> <20191014111719.141bd4fa@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191014111719.141bd4fa@gandalf.local.home> 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 Mon 2019-10-14 11:17:19, Steven Rostedt wrote: > On Mon, 14 Oct 2019 12:59:23 +0200 > Miroslav Benes wrote: > > > int > > ftrace_enable_sysctl(struct ctl_table *table, int write, > > void __user *buffer, size_t *lenp, > > @@ -6740,8 +6754,6 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, > > if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled)) > > goto out; > > > > - last_ftrace_enabled = !!ftrace_enabled; > > - > > if (ftrace_enabled) { > > > > /* we are starting ftrace again */ > > @@ -6752,12 +6764,19 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, > > ftrace_startup_sysctl(); > > > > } else { > > + if (is_permanent_ops_registered()) { > > + ftrace_enabled = last_ftrace_enabled; > > Although this is not incorrect, but may be somewhat confusing. > > At this location, last_ftrace_enabled is always true. > > I'm thinking this would be better to simply set it to false here. IMHO, we want to set ftrace_enabled = true here. It was set to "false" by writing to the sysfs file. But the change gets rejected. ftrace will stay enabled. So, we should set the value back to "true". > > + ret = -EBUSY; > > + goto out; > > + } > > + > > /* stopping ftrace calls (just send to ftrace_stub) */ > > ftrace_trace_function = ftrace_stub; > > > > ftrace_shutdown_sysctl(); > > } > > > > + last_ftrace_enabled = !!ftrace_enabled; > > out: > > And move the assignment of last_ftrace_enabled to after the "out:" > label. This change might make sense anyway. But it is not strictly necessary from my POV. Best Regards, Petr