Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1063056ybl; Wed, 28 Aug 2019 09:07:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmogPeua144blzy8pD8XnJzXsF3Z+ABaXUwdttPNs6emYAOmb8hdJnXl3gNK+SlNX4p6yB X-Received: by 2002:a63:b904:: with SMTP id z4mr4023765pge.388.1567008447839; Wed, 28 Aug 2019 09:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567008447; cv=none; d=google.com; s=arc-20160816; b=A+uensnD5089KAfTCIDaBQxQZb+vYsS6TrA1Eoukp7Pi1HrkXhFLupfgh7ZwzsrrRe cSfQ6/vlMYZV6dXIMf4W1mhEZma6nuXLzYmY6W2W5j8YMZLJvqFi1DaBV+C2trZK5Jmk T+uLoSt7XzBYn4G7U+bU+SMg2jT48wnmtasfiRImlB+3lz3YY81Hc9mE2wWTN6NsTFps Dhcsr1f9CKfKBmYwKa8XPmgiuE65Nq21hQLPKHTA2DrZ+UmcW2/eFSzNOHw3qzl3YMlz AmBQFSCZ+zqap/W8w6SOfuXMMiLDQFoi5zHC4XA49bSWSjZaa7PS5rGuDoLypB9PlYUF GZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=3xYxXDiniqZIDNImiQ/OJQR4xfWAO6QnDax2ROd9LIs=; b=mrR4wnDxLkfC1Onurxn+nuuG5MzWvygefHv8L4ZiKZ5CmfX1cKgx7M/vSDd/4J3ig7 LgUWdBxhV92U1e8haNR1DjqINDFdkPx6BCkpNiZX7XTNVMPO356PTvYS64Wva3biiGEq 8ctxyuoJS0G/3OFzcVrs43LUoMigY61rW3YQRvYWRVwj6gTxyzvafLYvIalE4K1PkwWF oehD2njAfU7/iJEB9qla3Na5SMv9W2xn/cwNe9QfIrtJPsZuTtn/qKDZhZfsJwATZQUN 40/ph+k6QlUmWcB9erPkgyUkfZ0lBGrT/N3e0LhF4DL/IjgoJibW4bsozYyW6seDZgIB KIRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=KsT2Kjht; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si2299618pgp.424.2019.08.28.09.07.11; Wed, 28 Aug 2019 09:07:27 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=KsT2Kjht; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726829AbfH1QGB (ORCPT + 99 others); Wed, 28 Aug 2019 12:06:01 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:44504 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbfH1QGA (ORCPT ); Wed, 28 Aug 2019 12:06:00 -0400 Received: by mail-lf1-f67.google.com with SMTP id v16so2611484lfg.11 for ; Wed, 28 Aug 2019 09:05:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3xYxXDiniqZIDNImiQ/OJQR4xfWAO6QnDax2ROd9LIs=; b=KsT2KjhtpQ6GNJNB6OOrOez6CyFCWwdJGMlrf3dDm3adU1nxNL4WBLh5geAc6aqb6Q CCPXYwZtghUy2Xhu3pc9x6aEt/kGNC5oPSpiQCxndjgrhjbWcoSgY29kTuEndw1aTJnj fXv6g285PAxsQVr2kNWwJHM5jhaSSL3cmY7gZqoV44lVDQEQ6nyee34m2SjBEzs2CVIk yQ0CpAQqPOEkYgndMmVLLuYVwBL/3/kgfk4ZyBvSjYRrLzJ1o7EmII90JCfFwLTA7s/m UPnvfO7qGF2rZyUZ0TSEcAjDaMiIstktMGDntlKSCwYkW4PsqObFicG047hEWqvW/reU u/nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3xYxXDiniqZIDNImiQ/OJQR4xfWAO6QnDax2ROd9LIs=; b=d/D1RTaGbMi1I6bt02h8sb+PdQtaQXJNE2CyB0isb2fVecYsDLxBMEnj7EHwQu3wVX XuI08qV+NNIPcGwhLFeObHW2chc2jQIhODfkoCBBxX7P2vYuTNQ/ZYRB0Kt9Ao1IeYvh m3kunMJZe9r5SpO3VqqP3Y/NM/IelRpbPb5KmgvRsuwGcPhTukbDI5TDMfyJESrH2Hb3 iDlUi51spP0bGzy1crJosr4RS5wUIOIq8tWwu2qoYdYu7AOrZLksgmPIs/0zvAD8drbj d63EiQxwcpZMMr9uAlETdWFwQDbaD1OIgeshE5YfQAGOBiFjxwNeJiF96+kH0HBDur8s ojfw== X-Gm-Message-State: APjAAAXpbj293vPhZjrOV/F4/woaMgs59hO53g/f8qW64RWa4BI8pKCJ VtfL/YxXijLdpy2OvLMfs78VmgXPhwj13ZpsJqpTAA== X-Received: by 2002:ac2:4210:: with SMTP id y16mr2767012lfh.139.1567008357576; Wed, 28 Aug 2019 09:05:57 -0700 (PDT) MIME-Version: 1.0 References: <20190827204152.114609-1-hridya@google.com> <20190827204152.114609-4-hridya@google.com> <20190828125952.ivvlxybw35kj67rj@wittgenstein> In-Reply-To: <20190828125952.ivvlxybw35kj67rj@wittgenstein> From: Todd Kjos Date: Wed, 28 Aug 2019 09:05:46 -0700 Message-ID: Subject: Re: [PATCH 3/4] binder: Make transaction_log available in binderfs To: Christian Brauner Cc: Hridya Valsaraju , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , "open list:ANDROID DRIVERS" , LKML , Android Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 5:59 AM Christian Brauner wrote: > > On Tue, Aug 27, 2019 at 01:41:51PM -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 > > Acked-by: Christian Brauner Acked-by: Todd Kjos > > > --- > > drivers/android/binder.c | 34 +++++-------------------------- > > drivers/android/binder_internal.h | 30 +++++++++++++++++++++++++++ > > drivers/android/binderfs.c | 19 +++++++++++++++++ > > 3 files changed, 54 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 d542f9b8d8ab..dc25a7d759c9 100644 > > --- a/drivers/android/binderfs.c > > +++ b/drivers/android/binderfs.c > > @@ -630,8 +630,27 @@ static int init_binder_logs(struct super_block *sb) > > > > file_dentry = binderfs_create_file(binder_logs_root_dir, "transactions", > > &binder_transactions_fops, NULL); > > + if (IS_ERR(file_dentry)) { > > + ret = PTR_ERR(file_dentry); > > + goto out; > > + } > > + > > + file_dentry = binderfs_create_file(binder_logs_root_dir, > > + "transaction_log", > > + &binder_transaction_log_fops, > > + &binder_transaction_log); > > + if (IS_ERR(file_dentry)) { > > + ret = PTR_ERR(file_dentry); > > + goto out; > > + } > > + > > + file_dentry = binderfs_create_file(binder_logs_root_dir, > > + "failed_transaction_log", > > + &binder_transaction_log_fops, > > + &binder_transaction_log_failed); > > if (IS_ERR(file_dentry)) > > ret = PTR_ERR(file_dentry); > > + > > out: > > return ret; > > } > > -- > > 2.23.0.187.g17f5b7556c-goog > >