All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Hang Lu <hangl@codeaurora.org>
Cc: tkjos@android.com, maco@android.com, arve@android.com,
	joel@joelfernandes.org, christian@brauner.io, hridya@google.com,
	surenb@google.com, rdunlap@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] binder: tell userspace to dump current backtrace when detecting oneway spamming
Date: Wed, 31 Mar 2021 09:44:12 +0200	[thread overview]
Message-ID: <YGQoTPnndiJ5+mk3@kroah.com> (raw)
In-Reply-To: <1617176056-1440-1-git-send-email-hangl@codeaurora.org>

On Wed, Mar 31, 2021 at 03:34:16PM +0800, Hang Lu wrote:
> When async binder buffer got exhausted, some normal oneway transaction
> will also be discarded and finally caused system/app stop. By that time,
> the binder debug information we dump may not relevant to the root cause.
> And this issue is difficult to debug if without the backtrace of thread
> sending spam.
> 
> This change will send BR_ONEWAY_SPAM_SUSPECT to userspace when detecting
> oneway spamming, request to dump current backtrace. The detection will
> happened only once when exceeding the threshold (target process dips
> below 80% of its oneway space, and current process is responsible for
> either more than 50 transactions, or more than 50% of the oneway space).
> And the detection will restart when the async buffer has returned to a
> healthy state.
> 
> Signed-off-by: Hang Lu <hangl@codeaurora.org>
> ---
>  drivers/android/binder.c            | 25 ++++++++++++++++++++++---
>  drivers/android/binder_alloc.c      | 15 ++++++++++++---
>  drivers/android/binder_alloc.h      |  8 +++++++-
>  drivers/android/binder_internal.h   |  1 +
>  include/uapi/linux/android/binder.h |  8 ++++++++
>  5 files changed, 50 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index c119736..28ceaf9 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -87,6 +87,7 @@ static DEFINE_SPINLOCK(binder_dead_nodes_lock);
>  static struct dentry *binder_debugfs_dir_entry_root;
>  static struct dentry *binder_debugfs_dir_entry_proc;
>  static atomic_t binder_last_id;
> +static bool oneway_spam_detection_enabled;

Why is this a "whole system" value and not a "per binder instance"
value?  You just allowed one binder instance to affect another one,
which does not seem like a good idea to me :(

thanks,

greg k-h

  reply	other threads:[~2021-03-31  7:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31  7:34 [PATCH] binder: tell userspace to dump current backtrace when detecting oneway spamming Hang Lu
2021-03-31  7:44 ` Greg KH [this message]
2021-04-01  8:05   ` Hang Lu
2021-04-01  8:28     ` [PATCH v2] " Hang Lu
2021-04-06 20:26       ` Todd Kjos
2021-04-07  3:14         ` [PATCH v3] " Hang Lu
2021-04-07  4:11           ` [PATCH v4] " Hang Lu
2021-04-07 19:38             ` Todd Kjos
2021-04-09  3:40               ` [PATCH v4] binder: tell userspace to dump current backtrace when detected " Hang Lu
2021-04-09  6:08                 ` Greg KH
2021-04-09  6:21                   ` Hang Lu
2021-04-09  6:25                     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YGQoTPnndiJ5+mk3@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arve@android.com \
    --cc=christian@brauner.io \
    --cc=hangl@codeaurora.org \
    --cc=hridya@google.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=rdunlap@infradead.org \
    --cc=surenb@google.com \
    --cc=tkjos@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.