Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp6084607ybg; Tue, 22 Oct 2019 12:54:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvXh2ya6Y4lovNfPpXYMYYhcObM7NzKx0qUsGM+UIZp2bSheNFgxNesAef03R0MteBBEpQ X-Received: by 2002:aa7:d852:: with SMTP id f18mr6906033eds.110.1571774087006; Tue, 22 Oct 2019 12:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571774086; cv=none; d=google.com; s=arc-20160816; b=AsXI0YWVH5has8treRbUaqoeAi6i3qVRNmW483th0hmXrBVLWSuifskRFOvxb2Y8ZB Wr0/93RwNP8wL02YyFnv9tHRCx0b2fghZAeaw9Ro6chplfKcccjMmDb6+DvzoLIEiQAB uODqMTv5IBQh6WCG7FvT3AHtHDMrK2jHUVWdsBw3usWwdTKNQ0qi5iyR5rbRYyOvaGez FplCudSRqaeLn39qV6q6jlvlNwz9ZPn+jRMXjlpAJk81ExhgDr4gwJjjLkVy3/phVKkS XIYF2W8V7+Cy5gH8BCQiilCivr8fbwHUt/jQOWz/F46Q3piaUL0HJgXkCtQuDsuYOGzY BfIQ== 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=KImN0PJkr+z1KxLIaHqX0ucsKQmK9O8LAXnO9X5dBek=; b=Eab37l4FRfgrZxE0Q5j1xnfelVZtEsHGKuJBNoULJ78lAZsMnRwqJty7rUXYVj6TSi pjqp4SBD7+ZDFVj2/Btl1ooJeWkRUGFNYl/Ic9vDfnL1yHIj0GNHWSJ5GKNkg+0tSx57 ZG/kWr7ruT+kB9TrdJDQKNdCpgGI7ZA3K7UiWzTCOe1HTxl60L9swjY1cQEQAJqGq5kC 7sF+UzEbuL3+bYdM1FuR246xJfFjRHcXM72UntamR/sJlCt7meWIQ+zkoyviVYk0JtQh L0PV5dnwPysegDJiEHZ5LCpoBZWX7v4wKN4Yb7kuCqdQ2OD26T8bMeuB+CHjACyWcfp2 7rOQ== 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 n6si11432975ejj.232.2019.10.22.12.54.20; Tue, 22 Oct 2019 12:54:46 -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 S1732856AbfJVTvH (ORCPT + 99 others); Tue, 22 Oct 2019 15:51:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:54138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731436AbfJVTvG (ORCPT ); Tue, 22 Oct 2019 15:51:06 -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 251B721872; Tue, 22 Oct 2019 19:51:06 +0000 (UTC) Date: Tue, 22 Oct 2019 15:51:04 -0400 From: Steven Rostedt To: Hassan Naveed Cc: Ingo Molnar , "linux-kernel@vger.kernel.org" , Paul Burton Subject: Re: [PATCH] TRACING: FTRACE: Use xarray structure for ftrace syscalls Message-ID: <20191022155104.29b062a5@gandalf.local.home> In-Reply-To: <20191022182303.14829-1-hnaveed@wavecomp.com> References: <20191022182303.14829-1-hnaveed@wavecomp.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 Tue, 22 Oct 2019 18:24:25 +0000 Hassan Naveed wrote: Nit, the subject should simply be: "tracing: Use xarray for syscall trace events" > Signed-off-by: Hassan Naveed > --- > kernel/trace/trace_syscalls.c | 17 ++++------------- > 1 file changed, 4 insertions(+), 13 deletions(-) > > diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c > index f93a56d2db27..1fee710be874 100644 > --- a/kernel/trace/trace_syscalls.c > +++ b/kernel/trace/trace_syscalls.c > @@ -7,6 +7,7 @@ > #include /* for MODULE_NAME_LEN via KSYM_SYMBOL_LEN */ > #include > #include > +#include > #include > > #include "trace_output.h" > @@ -30,7 +31,7 @@ syscall_get_enter_fields(struct trace_event_call *call) > extern struct syscall_metadata *__start_syscalls_metadata[]; > extern struct syscall_metadata *__stop_syscalls_metadata[]; > > -static struct syscall_metadata **syscalls_metadata; > +static DEFINE_XARRAY(syscalls_metadata); > > #ifndef ARCH_HAS_SYSCALL_MATCH_SYM_NAME > static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) > @@ -101,10 +102,7 @@ find_syscall_meta(unsigned long syscall) > > static struct syscall_metadata *syscall_nr_to_meta(int nr) > { > - if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) > - return NULL; > - > - return syscalls_metadata[nr]; > + return xa_load(&syscalls_metadata, (unsigned long)nr); > } > > const char *get_syscall_name(int syscall) > @@ -535,13 +533,6 @@ void __init init_ftrace_syscalls(void) > unsigned long addr; > int i; > > - syscalls_metadata = kcalloc(NR_syscalls, sizeof(*syscalls_metadata), > - GFP_KERNEL); > - if (!syscalls_metadata) { > - WARN_ON(1); > - return; > - } > - > for (i = 0; i < NR_syscalls; i++) { > addr = arch_syscall_addr(i); > meta = find_syscall_meta(addr); > @@ -549,7 +540,7 @@ void __init init_ftrace_syscalls(void) > continue; > > meta->syscall_nr = i; > - syscalls_metadata[i] = meta; > + xa_store(&syscalls_metadata, i, meta, GFP_KERNEL); Shouldn't xa_store() return be tested for memory failure? -- Steve > } > } >