Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2358473ybp; Thu, 10 Oct 2019 06:20:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOl653AeF6AeYyL4w5BX1IniWhTrhe1yaxbOB7b86A7cyAU3yNbCen8999LD7lCLAsBBMF X-Received: by 2002:a17:906:480a:: with SMTP id w10mr8057694ejq.212.1570713631948; Thu, 10 Oct 2019 06:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570713631; cv=none; d=google.com; s=arc-20160816; b=L9DUCP3SXYaUoKsJyPnTFwR74YaFQTsp11/IpjRGlEoahUu1h0V3ZOr0onfxxytjQQ aXdDy5FuCd9NvCMW7P2ew2/g3XI0Uxnt8FXeMHRaMcT+cJGu2EcjNJtOBzhZ7V46ob59 3sPpq138YIlkHmD29xBPzKmi1brKJJ8hkYbxjHE32rdS51NsPPRfSrGnEERIzMJa/w+T Cee7x1oxGBREvsvShAW+FnGg7hhpCh3H1rKSe6vxD8vcA0XO/2VoKpFJwGj2cYff0LKB 0Y4V4Wgfi06p2o5C/gn5hFvCWTikGS5xUehehj48nSbZabqhentbS4dKJOW965eZqVKE e68w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=gTpAtE1+VizMUnvB2rCCCFWJmMbSyH8yvmz8xFC/A70=; b=P7RpFbFmp05g7AkHnW52cJdH248hhhc/+Y+2aDqlR85Tjsfq2idEseScBdspQlclvp 0o6ZUaYXsZ7D5X3eW201yNLbu9y8PA5OZzpJ5w7RvIXa/fIiM8oM6jC2RMM+eKGXw+yd 83xRK+2rXIoh5uSgCWmQNz0NWmGLPfvX+FZPapbEe1XaNJW1shCkmIfodPAAwRuyiR4y SCGNI2IFHlUuws/KCtqI70xe8g85N34SDwmsZPsCaPL9ukYYXFoJ4pUYoKMkcxNwDJQQ RoVuznO6lbnpf8Qnr1K4rQUVoTCoDc9ijnR9eoP8zcJt6689vGHO9fenD8TXiDlneum/ 4HcA== 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 h13si3598284edh.242.2019.10.10.06.20.07; Thu, 10 Oct 2019 06:20:31 -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 S2388130AbfJJNUA (ORCPT + 99 others); Thu, 10 Oct 2019 09:20:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727852AbfJJNUA (ORCPT ); Thu, 10 Oct 2019 09:20:00 -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 456B92064A; Thu, 10 Oct 2019 13:19:58 +0000 (UTC) Date: Thu, 10 Oct 2019 09:19:56 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, mhiramat@kernel.org, bristot@redhat.com, jbaron@akamai.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, namit@vmware.com, hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org, jpoimboe@redhat.com Subject: Re: [PATCH v3 5/6] x86/ftrace: Use text_poke() Message-ID: <20191010091956.48fbcf42@gandalf.local.home> In-Reply-To: <20191010092054.GR2311@hirez.programming.kicks-ass.net> References: <20191007081716.07616230.8@infradead.org> <20191007081945.10951536.8@infradead.org> <20191008104335.6fcd78c9@gandalf.local.home> <20191009224135.2dcf7767@oasis.local.home> <20191010092054.GR2311@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 Oct 2019 11:20:54 +0200 Peter Zijlstra wrote: > On Wed, Oct 09, 2019 at 10:41:35PM -0400, Steven Rostedt wrote: > > On Tue, 8 Oct 2019 10:43:35 -0400 > > Steven Rostedt wrote: > > > > > > > BTW, I'd really like to take this patch series through my tree. That > > > way I can really hammer it, as well as I have code that will be built > > > on top of it. > > > > I did a bit of hammering and found two bugs. One I sent a patch to fix > > (adding a module when tracing is enabled), but the other bug I > > triggered, I'm too tired to debug right now. But figured I'd mention it > > anyway. > > I'm thinking this should fix it... Just not sure this is the right plce, > then again, we're doing the same thing in jump_label and static_call, so > perhaps we should do it like this. > > --- a/arch/x86/kernel/alternative.c > +++ b/arch/x86/kernel/alternative.c > @@ -1230,10 +1230,15 @@ void text_poke_queue(void *addr, const v > * dynamically allocated memory. This function should be used when it is > * not possible to allocate memory. > */ > -void text_poke_bp(void *addr, const void *opcode, size_t len, const void *emulate) > +void __ref text_poke_bp(void *addr, const void *opcode, size_t len, const void *emulate) > { > struct text_poke_loc tp; > > + if (unlikely(system_state == SYSTEM_BOOTING)) { > + text_poke_early(addr, opcode, len); > + return; > + } We need a new system state. SYSTEM_UP ? (Arg, that name is confusing, SYSTEM_BOOTING_SMP?) Or perhaps just test num_online_cpus()? if (unlikely(system_state == SYSTEM_BOOTING && num_online_cpus() == 1) ? Because we can't do the above once we have more than one CPU running. -- Steve > + > text_poke_loc_init(&tp, addr, opcode, len, emulate); > text_poke_bp_batch(&tp, 1); > }