Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2413595ybp; Thu, 10 Oct 2019 07:06:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCoPKZyogS/NtKN4z9g5NIlUkHEsc8R7PNWAMmeUpC77bCObZgFbsyespqxahE+Y/POElv X-Received: by 2002:a17:906:35cb:: with SMTP id p11mr8487402ejb.128.1570716392285; Thu, 10 Oct 2019 07:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570716392; cv=none; d=google.com; s=arc-20160816; b=aTGLzH+sLnq7yvNX9CQbalvo6h6gtBYMePBm9aEow4I8hnFrGDiHnaiqjgF79Q6Y6W M5XUkwtoGXF5HiAjjZK1s9ooh6RAl4T5Ddsk521SPuKCl+Ud1dV7UiuMevAFV54Q11ax G0dKe6sVqwhiW9bdl4DNNDJ+Lg4YlSs0+ESn23qel2ES/0rlhdg9dHI9TqlaLsJRuyAF 2O0uhtfooVqUUSLKS3d+oFcv6mRuU6JfylEIxndPxA2eIL+ggLNjNmCgbCZZf/1DTuw7 eHN+e5EzYzMnuiBQMw2X4c2sLE61M5sOHeJGKaDoBKrNaimpc8DyFG589hZcuY0jN/9B PahA== 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:dkim-signature; bh=HJMGdIDUdqLVB8qB2dHYqoNPThFa3sgfwA+s8un0WcY=; b=XdmCzx09aBU5OLeMPBFEZTNuBbsBLnQtQAUNqvls7bkjAJSBSo0qOcpJelfXLHbaYk NX15mtOZLw4pVFZfY/0aCUMgdhJWHTgXtMJqu4VXlK2K6oWFVxxXrHXSROlfGVeNZ+8f w4Rk3m1L3kVXlUcMbJM/+amAB9uWy5nBmE8CcBLGheV/DPe39DiKyNwQFsXUqC0qUG+i 2d11/YyfH82yHDLqi88Mns+tpzPQWVUvdJ42saqbKPkaW/FrTTDA5Tssvj/iSDfjU9mj zeOtRc2ZReX7rLMCljc7hnWV8JT1lcUPqzaBvm04IsXkGhmBunT0OXykxEv1GEANVEQU sdnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Fs9PDWsA; 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 i12si3565177edb.133.2019.10.10.07.06.01; Thu, 10 Oct 2019 07:06:32 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Fs9PDWsA; 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 S1726265AbfJJOF1 (ORCPT + 99 others); Thu, 10 Oct 2019 10:05:27 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38186 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726229AbfJJOF1 (ORCPT ); Thu, 10 Oct 2019 10:05:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HJMGdIDUdqLVB8qB2dHYqoNPThFa3sgfwA+s8un0WcY=; b=Fs9PDWsAxkehwhcU+Ti/MUQD/ ekjV9O6rcSKqtxEMU7oKyYOCFTVpGRDf1ZPMuNpZSfbhNZCM2saoVQ4Ds3vVgxByZSXBovof6gK/N nfSd7z9A/bFSO11guf7om2NJ/4kd62RpoHejk33XI1K9Ok5TnPDdy/BfhescQ7VlTvDPSfOdhjwMl scGT852MF+OMcWlg1epmnMBBAvYHRQSUIV6jdyylD0Nqo+EMHZTkT/FsOeNsqanNotKBRYPxWh2m8 dZioEXAZoe7tcOslHEyHAOm5HUFT7eHjfxkhkUS7wMDwpdb4gR60MXLv38xHNnVSVSnWMMqiND70h 1zxMHSRmA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iIZ48-00072M-CE; Thu, 10 Oct 2019 14:05:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 39855301224; Thu, 10 Oct 2019 16:04:21 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 41952202F4F4F; Thu, 10 Oct 2019 16:05:13 +0200 (CEST) Date: Thu, 10 Oct 2019 16:05:13 +0200 From: Peter Zijlstra To: Steven Rostedt 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: <20191010140513.GT2311@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> <20191010091956.48fbcf42@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191010091956.48fbcf42@gandalf.local.home> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 10, 2019 at 09:19:56AM -0400, Steven Rostedt wrote: > 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. We loose BOOTING _long_ before we gain SMP.