Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2110756ybp; Thu, 10 Oct 2019 02:21:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKTH5VG1ZOguIFHy+NWwTRmuORzO+8mPjaRy6J8Rs5Dsq4IAscPFdMJ70tDrs9IwzK+eRS X-Received: by 2002:a17:907:429c:: with SMTP id ny20mr6932371ejb.234.1570699302554; Thu, 10 Oct 2019 02:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570699302; cv=none; d=google.com; s=arc-20160816; b=mm1y35MJuenfTtyNERwy3HAVAjANUtO/FhhRLK2jicIoRl2keo2LZfOTENQRL6i+QL 9uWxTByw/Y2f1z/rdfT63vRFTqga7EbQ8hiXkSjtoyiFYlaZCyGG/FrU8iED1H1i4daz rpFH9pkmy3k204a1zpV2FOWiCLEteANohy+OL0w0mrx422oB05fJNzwU3w+vk6dgA8Aw 2I1LZuW0o6D9WXOeF2FDPb275SvPkMVfSSS81W7qhVWkNGy33k6tOyodbSPkfGB4ngDc ZScax5lbVUNaHY/LuEEVcOhEa293U+ktKxnk+JU4ERUZBmS8ImBjzUoYIKdOl2Vd2ucu qRxQ== 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=dM+zNGSNOaaeInNQWIpN++xOSr2s5LE3tb5oYqXmsDk=; b=eHqId0QpVKA5y4+5e3v6n36kMrHA0fcCaEWIt0wygN53NItlR7KA7B43w6QCy7Q0JH PIum2w222WpBZHdqgyBx67AW3dcKnt+nNEavbcykT/tsAf0fmkMOyIvtml7lu5LPqOgD FJmnMZpOSPLGzCLtokhFXfdfQ3+ww2muQrdiFBi1vAc0UO47gBNgbmkpQWt81uQJgp7j hce4BszxzgEHMRsHqQn6Xti1/sUB7o/aqz02nvImE/CS0HkjTOcVwKY7juYbN31CUSvi L8BhG+XtCXTihrN7T/kGOarSWGOgi0mrjA/2pfAraREkTZEEQ1ajdaNMeyE2t4XPe27r +sGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=BgqoRbf8; 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 r19si2715447edy.409.2019.10.10.02.21.18; Thu, 10 Oct 2019 02:21:42 -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=merlin.20170209 header.b=BgqoRbf8; 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 S2387927AbfJJJVM (ORCPT + 99 others); Thu, 10 Oct 2019 05:21:12 -0400 Received: from merlin.infradead.org ([205.233.59.134]:58208 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387463AbfJJJVL (ORCPT ); Thu, 10 Oct 2019 05:21:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=dM+zNGSNOaaeInNQWIpN++xOSr2s5LE3tb5oYqXmsDk=; b=BgqoRbf8yoW75UGASXF0z271y +I7Rmq8VsjAqIUZI7sGA+Sw9AHCNQnH0GV8qNoghODvF19KAM9nDybqOl1A7R6/Ig32PV7b/1w2FG jHhW137wJkZRnIzsGafbCbZU3ynvwCqoK8nk0KkYkyNOgSBnh+D3aIChvsW6li15O6Rl5dOUT/6fj fMj+91tlNlNY5QBuVlsVQSHpfhRGmy9rUHAU/NhQ2elzFr9xyT0zebHIekSMRb7u/9fxsn4IMoJic mnZ7M4i7tRWnY6Sh3C++UORyTKn1d1KRXc4dWAjM0OKba1fgPd4mDVo0okHoDcxrwb82bTmaXX+rh /dUSyeBug==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.2 #3 (Red Hat Linux)) id 1iIUcy-00013x-K3; Thu, 10 Oct 2019 09:20:56 +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 AE3C1307092; Thu, 10 Oct 2019 11:20:02 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ACD9720C3749A; Thu, 10 Oct 2019 11:20:54 +0200 (CEST) Date: Thu, 10 Oct 2019 11:20:54 +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: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191009224135.2dcf7767@oasis.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 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; + } + text_poke_loc_init(&tp, addr, opcode, len, emulate); text_poke_bp_batch(&tp, 1); }