2020-09-16 19:17:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v9 3/3] binder: add transaction latency tracer

On Tue, Sep 08, 2020 at 10:06:48PM +0800, Frankie Chang wrote:
> +#if IS_ENABLED(CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING)
> +#include <linux/rtc.h>
> +#include <linux/time.h>
> +#endif
> +
> struct binder_context {
> struct binder_node *binder_context_mgr_node;
> struct mutex context_mgr_node_lock;
> @@ -524,6 +529,14 @@ struct binder_transaction {
> * during thread teardown
> */
> spinlock_t lock;
> + /**
> + * @ts and @real_ts are used to record the time
> + * that the binder transaction startup
> + */
> +#if IS_ENABLED(CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING)
> + struct timespec64 ts;
> + struct timespec64 real_ts;

Why isn't this ktime_t? Is timespec64 really something to be using
still?

thanks,

greg k-h


2020-10-15 17:06:28

by Frankie Chang

[permalink] [raw]
Subject: [PATCH v10 3/3] binder: add transaction latency tracer

Change from v10:
- replace timespec64 with ktime_t.
- fix build warning.

Change from v9:
- rename timestamp to ts in binder_internal.h for conciseness.
- change timeval to timespec64 in binder_internal.h

Change from v8:
- change rtc_time_to_tm to rtc_time64_to_tm.
- change timeval to __kernel_old_timeval due to
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c766d1472c70d25ad475cf56042af1652e792b23
- export tracepoint symbol for binder_txn_latency_* which binder_transaction_latency_tracer to be ko needed.

Change from v7:
- Use the passed-in values instead of accessing via t->from/to_proc/to_thread
for trace_binder_txn_latency_free, when trace_binder_txn_latency_free_enable() return true.
- make a helper function to do the above.

Change from v6:
- change CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING type from bool to tristate
- add comments to @timestamp and @tv under struct binder_transaction
- make binder_txn_latency threshold configurable
- enhance lock protection

Change from v5:
- change config name to the proper one, CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING.
- change tracepoint name to more descriptive one, trace_binder_txn_latency_(alloc|info|free)
- enhance some lock protection.

Change from v4:
- split up into patch series.

Change from v3:
- use tracepoints for binder_update_info and print_binder_transaction_ext,
instead of custom registration functions.

Change from v2:
- create transaction latency module to monitor slow transaction.

Change from v1:
- first patchset.


Frankie.Chang (3):
binder: move structs from core file to header file
binder: add trace at free transaction.
binder: add transaction latency tracer

drivers/android/Kconfig | 8 +
drivers/android/Makefile | 1 +
drivers/android/binder.c | 430 ++----------------------
drivers/android/binder_internal.h | 418 +++++++++++++++++++++++
drivers/android/binder_latency_tracer.c | 107 ++++++
drivers/android/binder_trace.h | 49 +++
6 files changed, 607 insertions(+), 406 deletions(-) create mode 100644 drivers/android/binder_latency_tracer.c

2020-10-29 16:11:25

by Frankie Chang

[permalink] [raw]
Subject: binder: add transaction latency tracer

Change from v11:
- rebase.

Change from v10:
- replace timespec64 with ktime_t.
- fix build warning.

Change from v9:
- rename timestamp to ts in binder_internal.h for conciseness.
- change timeval to timespec64 in binder_internal.h

Change from v8:
- change rtc_time_to_tm to rtc_time64_to_tm.
- change timeval to __kernel_old_timeval due to
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c766d1472c70d25ad475cf56042af1652e792b23
- export tracepoint symbol for binder_txn_latency_* which binder_transaction_latency_tracer to be ko needed.

Change from v7:
- Use the passed-in values instead of accessing via t->from/to_proc/to_thread
for trace_binder_txn_latency_free, when trace_binder_txn_latency_free_enable() return true.
- make a helper function to do the above.

Change from v6:
- change CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING type from bool to tristate
- add comments to @timestamp and @tv under struct binder_transaction
- make binder_txn_latency threshold configurable
- enhance lock protection

Change from v5:
- change config name to the proper one, CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING.
- change tracepoint name to more descriptive one, trace_binder_txn_latency_(alloc|info|free)
- enhance some lock protection.

Change from v4:
- split up into patch series.

Change from v3:
- use tracepoints for binder_update_info and print_binder_transaction_ext,
instead of custom registration functions.

Change from v2:
- create transaction latency module to monitor slow transaction.

Change from v1:
- first patchset.


Frankie.Chang (3):
binder: move structs from core file to header file
binder: add trace at free transaction.
binder: add transaction latency tracer

drivers/android/Kconfig | 8 +
drivers/android/Makefile | 1 +
drivers/android/binder.c | 430 ++----------------------
drivers/android/binder_internal.h | 419 +++++++++++++++++++++++
drivers/android/binder_latency_tracer.c | 107 ++++++
drivers/android/binder_trace.h | 49 +++
6 files changed, 608 insertions(+), 406 deletions(-)
create mode 100644 drivers/android/binder_latency_tracer.c

2020-11-09 17:47:17

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: binder: add transaction latency tracer

On Fri, Oct 30, 2020 at 12:08:54AM +0800, Frankie Chang wrote:
> Change from v11:
> - rebase.

This whole patch set is sent with DOS line-ends, which makes git really
unhappy when it tries to apply it, as rightfully, it doesn't know how to
convert things.

Please resend this patch series as a plain-text patch series. Perhaps
using git send-email? Something is converting these patches to an odd
encoding which makes them not able to be applied.

Try sending them to yourself first, and seeing if you can apply them
from the messages directly, and if so, then resend them.

thanks,

greg k-h

2020-11-10 07:34:55

by Frankie Chang

[permalink] [raw]
Subject: Re: binder: add transaction latency tracer

On Mon, 2020-11-09 at 18:46 +0100, Greg Kroah-Hartman wrote:
> On Fri, Oct 30, 2020 at 12:08:54AM +0800, Frankie Chang wrote:
> > Change from v11:
> > - rebase.
>
> This whole patch set is sent with DOS line-ends, which makes git really
> unhappy when it tries to apply it, as rightfully, it doesn't know how to
> convert things.
>
Hmm.., actually I can use 'git apply' PATCH v11 from the message
directly.

> Please resend this patch series as a plain-text patch series. Perhaps
> using git send-email? Something is converting these patches to an odd
> encoding which makes them not able to be applied.
>
And I sent the patch set using git send-email. Hence, I am not sure what
happened when the patch set sent to others.

> Try sending them to yourself first, and seeing if you can apply them
> from the messages directly, and if so, then resend them.
>
But I will still verify locally and resend again.

thanks

Frankie Chang

2020-11-10 07:53:20

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: binder: add transaction latency tracer

On Tue, Nov 10, 2020 at 03:33:00PM +0800, Frankie Chang wrote:
> On Mon, 2020-11-09 at 18:46 +0100, Greg Kroah-Hartman wrote:
> > On Fri, Oct 30, 2020 at 12:08:54AM +0800, Frankie Chang wrote:
> > > Change from v11:
> > > - rebase.
> >
> > This whole patch set is sent with DOS line-ends, which makes git really
> > unhappy when it tries to apply it, as rightfully, it doesn't know how to
> > convert things.
> >
> Hmm.., actually I can use 'git apply' PATCH v11 from the message
> directly.

Ok, let me see if I can figure this out on my end, let me try using `b4`
on this to see if that helps...

2020-11-10 07:55:35

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: binder: add transaction latency tracer

On Tue, Nov 10, 2020 at 08:52:09AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Nov 10, 2020 at 03:33:00PM +0800, Frankie Chang wrote:
> > On Mon, 2020-11-09 at 18:46 +0100, Greg Kroah-Hartman wrote:
> > > On Fri, Oct 30, 2020 at 12:08:54AM +0800, Frankie Chang wrote:
> > > > Change from v11:
> > > > - rebase.
> > >
> > > This whole patch set is sent with DOS line-ends, which makes git really
> > > unhappy when it tries to apply it, as rightfully, it doesn't know how to
> > > convert things.
> > >
> > Hmm.., actually I can use 'git apply' PATCH v11 from the message
> > directly.
>
> Ok, let me see if I can figure this out on my end, let me try using `b4`
> on this to see if that helps...

Nope, there's still some merge conflicts here. b4 fixed the line-end
issues, but can you please rebase on top of my char-misc-next branch in
the char.git tree on git.kernel.org and resend? I think some changes by
others are conflicting with this patchset somehow.

thanks,

greg k-h

2020-11-10 08:08:17

by Frankie Chang

[permalink] [raw]
Subject: Re: binder: add transaction latency tracer

On Tue, 2020-11-10 at 08:53 +0100, Greg Kroah-Hartman wrote:
> On Tue, Nov 10, 2020 at 08:52:09AM +0100, Greg Kroah-Hartman wrote:
> > On Tue, Nov 10, 2020 at 03:33:00PM +0800, Frankie Chang wrote:
> > > On Mon, 2020-11-09 at 18:46 +0100, Greg Kroah-Hartman wrote:
> > > > On Fri, Oct 30, 2020 at 12:08:54AM +0800, Frankie Chang wrote:
> > > > > Change from v11:
> > > > > - rebase.
> > > >
> > > > This whole patch set is sent with DOS line-ends, which makes git really
> > > > unhappy when it tries to apply it, as rightfully, it doesn't know how to
> > > > convert things.
> > > >
> > > Hmm.., actually I can use 'git apply' PATCH v11 from the message
> > > directly.
> >
> > Ok, let me see if I can figure this out on my end, let me try using `b4`
> > on this to see if that helps...
>
> Nope, there's still some merge conflicts here. b4 fixed the line-end
> issues, but can you please rebase on top of my char-misc-next branch in
> the char.git tree on git.kernel.org and resend? I think some changes by
> others are conflicting with this patchset somehow.
>
Thanks for helping the line-end issues,
I will rebase and verify locally then resend the patch set again.

Many thanks

Frankie Chang

2020-11-10 14:21:21

by Frankie Chang

[permalink] [raw]
Subject: [PATCH v12] binder: add transaction latency tracer

Change from v12:
- rebase.

Change from v11:
- rebase.

Change from v10:
- replace timespec64 with ktime_t.
- fix build warning.

Change from v9:
- rename timestamp to ts in binder_internal.h for conciseness.
- change timeval to timespec64 in binder_internal.h

Change from v8:
- change rtc_time_to_tm to rtc_time64_to_tm.
- change timeval to __kernel_old_timeval due to
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c766d1472c70d25ad475cf56042af1652e792b23
- export tracepoint symbol for binder_txn_latency_* which binder_transaction_latency_tracer to be ko needed.

Change from v7:
- Use the passed-in values instead of accessing via t->from/to_proc/to_thread
for trace_binder_txn_latency_free, when trace_binder_txn_latency_free_enable() return true.
- make a helper function to do the above.

Change from v6:
- change CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING type from bool to tristate
- add comments to @timestamp and @tv under struct binder_transaction
- make binder_txn_latency threshold configurable
- enhance lock protection

Change from v5:
- change config name to the proper one, CONFIG_BINDER_TRANSACTION_LATENCY_TRACKING.
- change tracepoint name to more descriptive one, trace_binder_txn_latency_(alloc|info|free)
- enhance some lock protection.

Change from v4:
- split up into patch series.

Change from v3:
- use tracepoints for binder_update_info and print_binder_transaction_ext,
instead of custom registration functions.

Change from v2:
- create transaction latency module to monitor slow transaction.

Change from v1:
- first patchset.


Frankie.Chang (3):
binder: move structs from core file to header file
binder: add trace at free transaction.
binder: add transaction latency tracer

drivers/android/Kconfig | 8 +
drivers/android/Makefile | 1 +
drivers/android/binder.c | 430 ++----------------------
drivers/android/binder_internal.h | 419 +++++++++++++++++++++++
drivers/android/binder_latency_tracer.c | 107 ++++++
drivers/android/binder_trace.h | 49 +++
6 files changed, 608 insertions(+), 406 deletions(-)
create mode 100644 drivers/android/binder_latency_tracer.c