Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5774180ybp; Tue, 15 Oct 2019 04:59:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfoXCiO6VIO0SzaqySyQgrXRT4qfm++/dzpSYTpX7jmgcBgMVWlZTywBDDQhCdgGRUulXZ X-Received: by 2002:a17:907:20c8:: with SMTP id qq8mr33328502ejb.311.1571140780218; Tue, 15 Oct 2019 04:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571140780; cv=none; d=google.com; s=arc-20160816; b=nCG7uAjqpBbIbivU/b4tSGcBrztIyknU3SdWbwQtdb4Fb+yzpWjZ/GT6gULJtp6iYu XqkvCqZ9qj2+/b3ljKofGwXXfzLke5bA8E6iZCAHIYh83qs5N2YngUnA+n+wmq/x4Mhx E1BdhSIMQ53A1r8g/g2RYBJwjqVVaOWACGvp8grvYy1jYXfVrREeRzlQ1/x4V9oc7waL /jFx5OvXjgNUP8dGYx9qLxrtPAtIVmKQuwwjuNiBFz9zFCTu2H5f4IshqXn6Tn0cmfe4 nKEr2+B4IAQMhHDtFn5PaC65SvbTbfLs5uPmnpFAq6Mx72QDINwbN0H+CEzBWSLWXpYp Ezig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=MotaaM0UffDZog6BNjBW/dXhsvubeJE21Z/eAfxwq8Q=; b=02X4oHYiBT6OgSAD2izL01Iig5u8CEACABAtU8bEykfW7K9dFd4mf32DT82uMLvGrH qXayjjz/Lyam9B+slDvXKB3YOwXKOOvDVftZceDhH0J9W6VdDQ8BWXRronO5ONzPFOHe n6jnAUe81gi49kr57CnMJxhPfUbQ8rZozEBQC+1PW9hAQVohzf6dKP1rCOUnJtWwBUEm cJmLHk5oA0/zLxCUdFj21IdjovW8xHAK0MPd680U31Lk6GqrpOMC9FRt2+kYQqyUAVMO hwEsSLJ0V7gQvKw1s5jiy+VAn1s8cfydFTEy5eY0+Qi5zKsRKg0z6h6BXSOAj3KBHFoH mcVQ== 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 f45si14014952edb.166.2019.10.15.04.59.15; Tue, 15 Oct 2019 04:59:40 -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 S1731550AbfJOKvD (ORCPT + 99 others); Tue, 15 Oct 2019 06:51:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:39368 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731364AbfJOKvC (ORCPT ); Tue, 15 Oct 2019 06:51:02 -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 6E6CBB4C2; Tue, 15 Oct 2019 10:51:00 +0000 (UTC) Date: Tue, 15 Oct 2019 12:50:59 +0200 (CEST) From: Miroslav Benes To: Petr Mladek cc: Steven Rostedt , 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 In-Reply-To: <20191015074540.bxehllisibls3kk7@pathway.suse.cz> Message-ID: References: <20191014105923.29607-1-mbenes@suse.cz> <20191014111719.141bd4fa@gandalf.local.home> <20191015074540.bxehllisibls3kk7@pathway.suse.cz> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Oct 2019, Petr Mladek wrote: > 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". That's correct. I can make it explicit as proposed. I just thought that 'ftrace_enabled = last_ftrace_enabled' was clear enough given Petr's explanation. > > > + 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. If it stays before "out:" label, last_ftrace_enabled is set if and only if it has to be set. I think it is better, but I can, of course, move it in v3 if Steven prefers it. Thanks Miroslav