Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp897965ybp; Fri, 4 Oct 2019 06:43:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqwED/se2onOrZkRZLQZrHt2aaRxvXIKOcaFWbi7bDcIgF52AYl9NgJFd/d0/kFDVw3GKd0/ X-Received: by 2002:a50:b6aa:: with SMTP id d39mr14969575ede.16.1570196633783; Fri, 04 Oct 2019 06:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570196633; cv=none; d=google.com; s=arc-20160816; b=0ReQ1jamOKMHV7ZPWjvAk1DWAuNNdPrF6fhNWAe1e3GtBG7/qV/K04H8Fhx2Y8T9cY aC+zJxNeM1EXL9J6AyBGEbiMPu3vR307TT3TBPqP8a++mo24C2b9gD+koTS8u/KE4UHu TazfcXCATLe7BlJqqyTehJWls0k3B8jFIjb9XFZ1lLpkSE1w/fqQz5lJ78XfgRglkK+X L2BYnKuQOGH2adGY0ckkrv+AWH8CWuGA2ONDpYG6zhBpHLM/TOq4hS+VTtOXY+CQVvAO 9apy7Wg5fcjTVVqdHPgWyO3xQe2QAQ0OnR+wcPFjBpK+leP33pvx58epYR3o7mpymkM9 AlUQ== 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=doCyR45uuFkf1HmQijYMa7iwSofmIoqgyKsxd48u7Yg=; b=qo9Ysie6Z20fOUjdJQeqKEbAu558Po+vLEB/OEgmCIyCIN530vJdOT4tmHIHdcnt0o qk+C8tyNt4DaoIe3Zsrz3WpQXR2zd97rGQDkAKJDYLoNigm+nWWwWpmsbGwtrh7IwQub QzK2ExROfw9g5XWl/7QxA01aBZbMVRWANmzIrGHknbe1q/RTybFW874+ZF7TjLhyO3wF gHjp+sWSIcfvHAit4CGNsM1GxDF2414m6oZkvhWHEwc0YeOY/gvSHJc9WsEcsgKn8IC2 a32DQ+W2YJqBSs+lJvGOpKB1prJPo4DytPFVnYoW2nE6acBx/S6g9sM8BMb1tD7dr+96 ynoQ== 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 64si3969216eda.384.2019.10.04.06.43.28; Fri, 04 Oct 2019 06:43:53 -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 S2388666AbfJDNkS (ORCPT + 99 others); Fri, 4 Oct 2019 09:40:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388272AbfJDNkR (ORCPT ); Fri, 4 Oct 2019 09:40:17 -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 5E2AE20700; Fri, 4 Oct 2019 13:40:16 +0000 (UTC) Date: Fri, 4 Oct 2019 09:40:14 -0400 From: Steven Rostedt To: Daniel Bristot de Oliveira Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, x86@kernel.org, Nadav Amit , Andy Lutomirski , Dave Hansen , Song Liu , Masami Hiramatsu Subject: Re: [PATCH 3/3] x86/ftrace: Use text_poke() Message-ID: <20191004094014.72a990ee@gandalf.local.home> In-Reply-To: <7b4196a4-b6e1-7e55-c3e1-a02d97c262c7@redhat.com> References: <20190827180622.159326993@infradead.org> <20190827181147.166658077@infradead.org> <20191002182106.GC4643@worktop.programming.kicks-ass.net> <20191003181045.7fb1a5b3@gandalf.local.home> <7b4196a4-b6e1-7e55-c3e1-a02d97c262c7@redhat.com> 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 Fri, 4 Oct 2019 10:10:47 +0200 Daniel Bristot de Oliveira wrote: > [ In addition ] > > Currently, ftrace_rec entries are ordered inside the group of functions, but > "groups of function" are not ordered. So, the current int3 handler does a (*): > > for_each_group_of_functions: > check if the ip is in the range ----> n by the number of groups. > do a bsearch. ----> log(n) by the numbers of entry > in the group. > > If, instead, it uses an ordered vector, the complexity would be log(n) by the > total number of entries, which is better. So, how bad is the idea of: BTW, I'm currently rewriting the grouping of the vectors, in order to shrink the size of each dyn_ftrace_rec (as we discussed at Kernel Recipes). I can make the groups all sorted in doing so, thus we can load the sorted if that's needed, without doing anything special. > > in the enabling ftrace code path, it: > discover the number of entries > alloc a buffer > discover the order of the groups > for each group in the correct order > queue the entry in the buffer > apply the changes using the text_poke... > > In this way we would optimize the two hot-paths: > int3 will be log(n) > IPIs bounded to 3. > > I am not saying we need to do it now, as Steve said, not sure if this is a big > problem, but... those that don't like kernel interference may complain. But if > we leave the per-use-case vector in the text_poke_batch interface, things will > be easier to fix. > > NOTE: the other IPIs are generated by hooking the tracepoints and switching the > code to RO/RW... Yeah, I did a trace of who is doing the on_each_cpu() call, and saw it coming from the RO/RW changes, which this patch series removes. -- Steve > > * as far as I understood ftrace_location_range(). > > -- Daniel > > > -- Steve > >