Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp773110ybz; Fri, 1 May 2020 08:17:10 -0700 (PDT) X-Google-Smtp-Source: APiQypIK8BF1o3JRMfyahQ7crhF9/GD1/HVymJSOQbBBQULdTLldUwf7Iz6qkoqn9WmNHkpnrsHM X-Received: by 2002:a17:906:35cd:: with SMTP id p13mr3838150ejb.206.1588346229992; Fri, 01 May 2020 08:17:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588346229; cv=none; d=google.com; s=arc-20160816; b=Nxwt8DYYSoqIMcnbheeGj4Ze+vYcNYsvN1zkpDSeOsARVUscywtSxzePlzOlS8pp0w mmCIt9/HMEKsjJBzzfALYgGmItWd/Q4j30g7lxkrHtOvhh/0cE8a+TjeGkUH8nwZo3sR Lc81t6Zirp7R2Jze59gS9hlIXRxPvmoVRrB1eN8kv1RamO1bqwiqMMmM7ksFWSPyXQtQ xbebLV51Npo9sddU3iD9Gm2AX+PHrIWBCZ806WIcvbPEO8cvpwULa/Kpf1KfeAO4Uiyt 2C67UTMQMktQkovTGotw15t0MevazRaKv8Pr2Vbm+sYw8Giy03M8MdfNpqVb0Qz22m1E Zl2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=F4yL4oTUsOpbnfJKXRJ3LDveHMm1KM/d4GtJdspShdk=; b=c+iB0Bw/BYVXgUIhU+RGeyv3An22/zE9LzR2PjziX0pMTvncyKhkR7epueWs2afaR7 LbS4j45Pp1lbj4O+5kBVlWHlV9ivFNds4m9x9UwBobMwacFHzVCnBU0fyKE4e06mjncF ecscD+iGKeRtcjvWdIpF0lBWA/udlJwZUeVR6F3AH23lpOk1uUtmPAt+SqRINJlxBPze wRlF96JOVAHwrtZEb5VBYiDg5ZbBu0V2IJ9dGi5fnIroHybIMBBjMWA642SPkUAV/Snw 81hOQdmRuggs/+bRf4179ABsaVi9VtnX9IuU1ygCD/mYOCfuS67u6w96XyObLE12J3Kt wvvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J3geM7oz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si1753175edy.66.2020.05.01.08.16.46; Fri, 01 May 2020 08:17:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=J3geM7oz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729042AbgEAPNW (ORCPT + 99 others); Fri, 1 May 2020 11:13:22 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:31005 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728896AbgEAPNW (ORCPT ); Fri, 1 May 2020 11:13:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588346000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=F4yL4oTUsOpbnfJKXRJ3LDveHMm1KM/d4GtJdspShdk=; b=J3geM7ozXb4qY+RP49bGdsP5j+GeJqJZIUkX9xPbQrqYF785LtBVSjgNv2WOCNwPfZAJeH 3Kk83PORUWrObJrUKXFMYsWFGSZGWyltXyz6gmRLOFKSSP1u4xkDHYxaQ+9nkQm5tugtvp XJL2ATLWWFJQSG12nsUTETVF8ySBBGQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-BCs19SbTMpe_3nCJyFV0SA-1; Fri, 01 May 2020 11:13:16 -0400 X-MC-Unique: BCs19SbTMpe_3nCJyFV0SA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F28568005B7; Fri, 1 May 2020 15:13:14 +0000 (UTC) Received: from treble (ovpn-114-104.rdu2.redhat.com [10.10.114.104]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBA6A5C1BB; Fri, 1 May 2020 15:13:12 +0000 (UTC) Date: Fri, 1 May 2020 10:13:10 -0500 From: Josh Poimboeuf To: Steven Rostedt Cc: LKML , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" Subject: Re: [RFC][PATCH] x86/ftrace: Have ftrace trampolines turn read-only at the end of system boot up Message-ID: <20200501151310.zo5bhnxpu5gubofj@treble> References: <20200430202147.4dc6e2de@oasis.local.home> <20200501044733.eqf6hc6erucsd43x@treble> <20200501051706.4wkrqwovybt2p6hr@treble> <20200501092404.06d1adcb@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200501092404.06d1adcb@gandalf.local.home> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 01, 2020 at 09:24:04AM -0400, Steven Rostedt wrote: > On Fri, 1 May 2020 00:17:06 -0500 > Josh Poimboeuf wrote: > > > > Would it be easier to just call a new __text_poke_bp() which skips the > > > SYSTEM_BOOTING check, since you know the trampoline will always be > > > read-only? > > > > > > Like: > > > > early_trace_init() is called after mm_init(), so I thought it might > > work, but I guess not: > > Yeah, I was about to say that this happens before mm_init() ;-) It happens *after* mm_init(). But now text_poke() has a dependency on poking_init(), has a dependency on proc_caches_init(), which has a dependency on kmem_cache_init_late(), etc. So how early do you need early_trace_init()? I'm assuming moving it to after kmem_cache_init_late() would be too late. > It's why we already have magic for enabling function tracing the first time. > > Do you see anything wrong with this current solution? It probably needs > more comments, but I wanted to get acceptance on the logic before I go and > pretty it up and send a non RFC patch. Assuming we can't get text_poke() working earlier, it seems reasonable to me. -- Josh