Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10903220imu; Thu, 6 Dec 2018 08:30:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/XdIBAgOAhhscwlmYrNJflpQwdf9a8K6iw/ll5Z2TH7H7vWqFQFtxIrXD+bSVxYocjXduu4 X-Received: by 2002:a63:101d:: with SMTP id f29mr24908220pgl.38.1544113850026; Thu, 06 Dec 2018 08:30:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544113849; cv=none; d=google.com; s=arc-20160816; b=DYFlTd6MhNmBbVqqQ9OfUps4uHRImOy5SIqgXIIBAv+1t9LJot0YMw/9uAQVkcqpUG 53pDwF+hJzOn/giPAlU01CgdeIbvvyk9FiVf6UnFBYKqADKfCROOJEvDMpUsCAKwE8do Lcv5O2nodulrKhHUjXHOLZ1WMgcg4vj7+sy0se88K/sHC4v/+GeEzO7YLQCw2owtJ49G QUxwyIXg+CVR3Fm+l/sFR2fNQ7qg32czdALGnvTRLEjCNzF/vi/DIbE0QfzBEJHVwThM isNYAQAKQyMjKkOpd78K0eR1tacYf3q5ip04UYlqTSVs2GKyQrbOdm4BlFP0VZjStNzh 2CoA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Xec3AbRr1ewYH1eTRNN7gm8e8fciqeRvXelwkD9Wghk=; b=I/Bc7iBEVjwMT2stnuSEIhamdW/SBejdLx70pGw/Y7ukkXk8NFWN2KcWFVhMGuSpdN HedD9g3MprK1b2aFhPDH3a33ZWYWrAAEANQ1y9CwbisBxui/BJxXj9E6zE2VY2qiSJFb s3tSbhceqS6lxd05d5jVyzwMxgXSB6gi77oU0Qw8/gDg+JgMPav7GzQm8tPb3aDwQRRN 1Na1SWCsEsmpFEpx2x7Li9xoZDs/tYPvzY461g+fkaEXPuF7H7WI2hQbxrP+SCf7TIKv t9uFgdET4Irl4oHwkGe0S1whdesBRLsWi8ZDPT+wJ2u/aWi5kQ7wyCK87Kui8yOwe3p5 yKPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JJRgsAn4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b124si595879pfg.47.2018.12.06.08.30.25; Thu, 06 Dec 2018 08:30:49 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=JJRgsAn4; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725996AbeLFQ3D (ORCPT + 99 others); Thu, 6 Dec 2018 11:29:03 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37322 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725907AbeLFQ3C (ORCPT ); Thu, 6 Dec 2018 11:29:02 -0500 Received: by mail-wm1-f68.google.com with SMTP id g67so1692743wmd.2; Thu, 06 Dec 2018 08:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Xec3AbRr1ewYH1eTRNN7gm8e8fciqeRvXelwkD9Wghk=; b=JJRgsAn4nIzv2GrnZSfxKeOfOg4wFt/aonskIS7bCRbaG4ODIpCdkjSVMSdLmSYCH1 viBWw+Uq52N6CtKXPw6+zBQTL64EIOCIOgYpIxCyBiqcyq9qFtBKSRJOzPiv2vLAPjen IkWOhXeWUyGrBZ988n84ye+GcIpkTsbcEyoqLlMEj7rctcvDCzToubqSB2yp7q2HK4m7 9QXTTE8zRa1X3axlxK5cyMiPEj3PN3KoryA27EzY5u3yW43dbGwMkh8kSrDt/0jKgTAf UQaZcWOt+BAdJk0U/2LGUIF7plP+tDRXa4amiiR2ck3jUuuj4VYpmiAcdW9O3Zlb3MkM pnwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Xec3AbRr1ewYH1eTRNN7gm8e8fciqeRvXelwkD9Wghk=; b=GhZchcywbjr6lWXzS2HqHcwCgdjmuBn7hvOitigfo6cIzSk93lB4OPpTeFofBSKZW7 BWykT7UlFKj8cVNAbtLrciToIb30wRDN1ap/muqMAWDMAqiKcNqSX4LuRDRSUnm71PLs eJ1vrPrNhlpB7ovn/dA/tg3hzd9dW2JdKeQyZIkRj3oLRK/RsupdcUlx0QYR40ZpSg6Y q4camhEm2WmjNIlb9BhoLv5eg6yDch87Lzpu9tfwuPaumo8DlNZlY0u8JTOZLKM7iFBC YVNUlhs7YLKCbCDf6WmAS+6oCFFw4GUsSk8LNhYq1oDECcHJS5OlKZ1XdVVjI4IsDqB0 yRfA== X-Gm-Message-State: AA+aEWZbG0PAqSCxRZB61oprxRtdVLf6SQXvMdHZzRlwenGT0otXg+L0 lsRBjbzSNyupKJL8UneeCbw= X-Received: by 2002:a1c:4108:: with SMTP id o8mr19618478wma.91.1544113740403; Thu, 06 Dec 2018 08:29:00 -0800 (PST) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id 14sm1966746wmv.36.2018.12.06.08.28.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 08:28:59 -0800 (PST) Date: Thu, 6 Dec 2018 17:28:57 +0100 From: Ingo Molnar To: Nadav Amit Cc: Ingo Molnar , Steven Rostedt , LKML , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Borislav Petkov , Andy Lutomirski , Dave Hansen , Peter Zijlstra , Damian Tometzki , linux-integrity , LSM List Subject: Re: [PATCH v7 08/14] x86/ftrace: Use text_poke_*() infrastructure Message-ID: <20181206162857.GA119243@gmail.com> References: <20181205013408.47725-1-namit@vmware.com> <20181205013408.47725-9-namit@vmware.com> <25B84F01-DB4C-4957-9703-769CCC9794BB@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <25B84F01-DB4C-4957-9703-769CCC9794BB@vmware.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Nadav Amit wrote: > > On Dec 4, 2018, at 5:34 PM, Nadav Amit wrote: > > > > A following patch is going to make module allocated memory > > non-executable. This requires to modify ftrace and make the memory > > executable again after it is configured. > > > > In addition, this patch makes ftrace use the general text poking > > infrastructure instead ftrace's homegrown text patching. This provides > > the advantages of having slightly "safer" code patching and avoiding > > races with module removal or other mechanisms that patch the kernel > > code. > > > > Cc: Steven Rostedt > > Signed-off-by: Nadav Amit > > --- > > arch/x86/kernel/ftrace.c | 74 +++++++++++++--------------------------- > > 1 file changed, 23 insertions(+), 51 deletions(-) > > Steven Rostedt pointed that using text_poke() instead of > probe_kernel_write() would introduce considerable overheads. Running: > > # time { echo function > current_tracer; } > > takes 0.24s without this patch and 0.7s with. I don’t know whether to > consider it “so bad”. Obviously we can introduce a batching mechanism and/or > do some micro-optimization (the latter will not buy us much though). This should definitely not regress, so can we try the batching approach? Thanks, Ingo