Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp605066ybl; Fri, 30 Aug 2019 04:36:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfZSrmc697xmm4tteu69fqQ2m7w9Rs9weV/wAaTgOiTBYxtSPcnA/kaIB3nQLUDPrAeMdm X-Received: by 2002:a62:3744:: with SMTP id e65mr18052962pfa.69.1567165014891; Fri, 30 Aug 2019 04:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567165014; cv=none; d=google.com; s=arc-20160816; b=c5GMmNL/GwvDUJSLRp2DdHC+6qggsjWVUYCUgwxjcgia1JA/4erksFxh0smdW3yPc9 OA8ItLTGHXmh4I9Y8yLFebjJOkMlp6vzfCRCF3KwjJteat1muO0lecXvE0J0ab1X3Hcx 0C9tLmCBkd9eeOcODVNO88HQatIIlxvfK4uFQRe1/XL0/QJfvJeraE4JFXY8OBiMDX32 EBLybNsVcBbyHFq1ulDgPdCTZIG6MErzIgDug4WIGLvHtdPVoRK9V9sgbF+/z1q2deYe XIy+0yfhB7zB/7dDlNHAjsiIXTqBft40CheRRe6YCV8Bgb9Rnulwx1C98duz2nJ4zqT7 0ucg== 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; bh=cl0AbvIpixuEwfJaIsfAhlBtAK48s6KyXyj5L/urZmM=; b=bmCFPwSPmu5+1Njp3QriITVcQZcy1fs7Ajs3N14XEdqresfsP1oNBwHW7kI+4ZpAhG GfRTSg0w8EGKb2TYJkRKDBWZGdbwpCvTkcv5Hou/MOaDDO6kxeaDM/vY0OpUN+6B1evc /9QDSMi5ZKFtKqVI8VWn2Vlph+Tg/Q5rZQRCP69OYKa6hSEetPo5yrxbxNCVJZICtV8o dTyymnEboRusHhw/SMSJMF3UR7MLVegFeUR9ccS5b6nEXw6qtY0VlddwbS8MAAKtMR7q RlYCndt+9RPaHb1l+MQg5m0Sca+2u/Xtp0lfGCX+cMct9PyHBrOqpDro2kJMlcWp/az5 3vaA== 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 69si4190941pgc.40.2019.08.30.04.36.38; Fri, 30 Aug 2019 04:36:54 -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 S1727781AbfH3LeY (ORCPT + 99 others); Fri, 30 Aug 2019 07:34:24 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:50852 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbfH3LeY (ORCPT ); Fri, 30 Aug 2019 07:34:24 -0400 Received: from [213.220.153.21] (helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i3fAb-00059e-KL; Fri, 30 Aug 2019 11:34:21 +0000 Date: Fri, 30 Aug 2019 13:34:20 +0200 From: Christian Brauner To: Hridya Valsaraju Cc: Greg Kroah-Hartman , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , Todd Kjos , Martijn Coenen , Joel Fernandes , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 3/4] binder: Make transaction_log available in binderfs Message-ID: <20190830113420.ikbjj37cn5qvlhmk@wittgenstein> References: <20190829211812.32520-1-hridya@google.com> <20190829211812.32520-4-hridya@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190829211812.32520-4-hridya@google.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 29, 2019 at 02:18:11PM -0700, Hridya Valsaraju wrote: > Currently, the binder transaction log files 'transaction_log' > and 'failed_transaction_log' live in debugfs at the following locations: > > /sys/kernel/debug/binder/failed_transaction_log > /sys/kernel/debug/binder/transaction_log > > This patch makes these files also available in a binderfs instance > mounted with the mount option "stats=global". > It does not affect the presence of these files in debugfs. > If a binderfs instance is mounted at path /dev/binderfs, the location of > these files will be as follows: > > /dev/binderfs/binder_logs/failed_transaction_log > /dev/binderfs/binder_logs/transaction_log > > This change provides an alternate option to access these files when > debugfs is not mounted. > > Signed-off-by: Hridya Valsaraju (If you don't change this patch in the next version, please just keep my: Acked-by: Christian Brauner when sending it out. :) > --- > > Changes in v2: > -Consistent variable naming accross functions as per Christian Brauner. > > drivers/android/binder.c | 34 +++++-------------------------- > drivers/android/binder_internal.h | 30 +++++++++++++++++++++++++++ > drivers/android/binderfs.c | 18 ++++++++++++++++ > 3 files changed, 53 insertions(+), 29 deletions(-) > > diff --git a/drivers/android/binder.c b/drivers/android/binder.c > index de795bd229c4..bed217310197 100644 > --- a/drivers/android/binder.c > +++ b/drivers/android/binder.c > @@ -197,30 +197,8 @@ static inline void binder_stats_created(enum binder_stat_types type) > atomic_inc(&binder_stats.obj_created[type]); > } > > -struct binder_transaction_log_entry { > - int debug_id; > - int debug_id_done; > - int call_type; > - int from_proc; > - int from_thread; > - int target_handle; > - int to_proc; > - int to_thread; > - int to_node; > - int data_size; > - int offsets_size; > - int return_error_line; > - uint32_t return_error; > - uint32_t return_error_param; > - const char *context_name; > -}; > -struct binder_transaction_log { > - atomic_t cur; > - bool full; > - struct binder_transaction_log_entry entry[32]; > -}; > -static struct binder_transaction_log binder_transaction_log; > -static struct binder_transaction_log binder_transaction_log_failed; > +struct binder_transaction_log binder_transaction_log; > +struct binder_transaction_log binder_transaction_log_failed; > > static struct binder_transaction_log_entry *binder_transaction_log_add( > struct binder_transaction_log *log) > @@ -6166,7 +6144,7 @@ static void print_binder_transaction_log_entry(struct seq_file *m, > "\n" : " (incomplete)\n"); > } > > -static int transaction_log_show(struct seq_file *m, void *unused) > +int binder_transaction_log_show(struct seq_file *m, void *unused) > { > struct binder_transaction_log *log = m->private; > unsigned int log_cur = atomic_read(&log->cur); > @@ -6198,8 +6176,6 @@ const struct file_operations binder_fops = { > .release = binder_release, > }; > > -DEFINE_SHOW_ATTRIBUTE(transaction_log); > - > static int __init init_binder_device(const char *name) > { > int ret; > @@ -6268,12 +6244,12 @@ static int __init binder_init(void) > 0444, > binder_debugfs_dir_entry_root, > &binder_transaction_log, > - &transaction_log_fops); > + &binder_transaction_log_fops); > debugfs_create_file("failed_transaction_log", > 0444, > binder_debugfs_dir_entry_root, > &binder_transaction_log_failed, > - &transaction_log_fops); > + &binder_transaction_log_fops); > } > > if (!IS_ENABLED(CONFIG_ANDROID_BINDERFS) && > diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h > index 12ef96f256c6..b9be42d9464c 100644 > --- a/drivers/android/binder_internal.h > +++ b/drivers/android/binder_internal.h > @@ -65,4 +65,34 @@ DEFINE_SHOW_ATTRIBUTE(binder_state); > > int binder_transactions_show(struct seq_file *m, void *unused); > DEFINE_SHOW_ATTRIBUTE(binder_transactions); > + > +int binder_transaction_log_show(struct seq_file *m, void *unused); > +DEFINE_SHOW_ATTRIBUTE(binder_transaction_log); > + > +struct binder_transaction_log_entry { > + int debug_id; > + int debug_id_done; > + int call_type; > + int from_proc; > + int from_thread; > + int target_handle; > + int to_proc; > + int to_thread; > + int to_node; > + int data_size; > + int offsets_size; > + int return_error_line; > + uint32_t return_error; > + uint32_t return_error_param; > + const char *context_name; > +}; > + > +struct binder_transaction_log { > + atomic_t cur; > + bool full; > + struct binder_transaction_log_entry entry[32]; > +}; > + > +extern struct binder_transaction_log binder_transaction_log; > +extern struct binder_transaction_log binder_transaction_log_failed; > #endif /* _LINUX_BINDER_INTERNAL_H */ > diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c > index 0e1e7c87cd33..1715e72ce9c7 100644 > --- a/drivers/android/binderfs.c > +++ b/drivers/android/binderfs.c > @@ -630,6 +630,24 @@ static int init_binder_logs(struct super_block *sb) > > dentry = binderfs_create_file(binder_logs_root_dir, "transactions", > &binder_transactions_fops, NULL); > + if (IS_ERR(dentry)) { > + ret = PTR_ERR(dentry); > + goto out; > + } > + > + dentry = binderfs_create_file(binder_logs_root_dir, > + "transaction_log", > + &binder_transaction_log_fops, > + &binder_transaction_log); > + if (IS_ERR(dentry)) { > + ret = PTR_ERR(dentry); > + goto out; > + } > + > + dentry = binderfs_create_file(binder_logs_root_dir, > + "failed_transaction_log", > + &binder_transaction_log_fops, > + &binder_transaction_log_failed); > if (IS_ERR(dentry)) > ret = PTR_ERR(dentry); > > -- > 2.23.0.187.g17f5b7556c-goog >