From b9ada56245d83bfafdb69e73e141b270a3285c1b Mon Sep 17 00:00:00 2001 From: Murilo Alves Date: Wed, 22 Dec 2021 11:14:07 -0300 Subject: [PATCH] Revert "(CR): FROMGIT: binder: BINDER_GET_FROZEN_INFO ioctl" This reverts commit ca4dd90f57b3e814a18495205f8823b7b456a70b. Freeze feature should be disabled both on upper and lower layers. Change-Id: I649ea96a42f7669103b760f94dec9302480593bd Signed-off-by: Murilo Alves Reviewed-on: https://gerrit.mot.com/2152150 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiaojun Ji Reviewed-by: Zhenxin Xi Submit-Approved: Jira Key --- drivers/android/binder.c | 76 ++++++++--------------------- drivers/android/binder_internal.h | 6 --- include/uapi/linux/android/binder.h | 7 --- 3 files changed, 19 insertions(+), 70 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 93d8e17d7408..216f315501b7 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -201,8 +201,25 @@ static struct binder_transaction_log_entry *binder_transaction_log_add( } enum binder_deferred_state { - BINDER_DEFERRED_FLUSH = 0x01, - BINDER_DEFERRED_RELEASE = 0x02, + BINDER_DEFERRED_PUT_FILES = 0x01, + BINDER_DEFERRED_FLUSH = 0x02, + BINDER_DEFERRED_RELEASE = 0x04, +}; + +/** + * struct binder_priority - scheduler policy and priority + * @sched_policy scheduler policy + * @prio [100..139] for SCHED_NORMAL, [0..99] for FIFO/RT + * + * The binder driver supports inheriting the following scheduler policies: + * SCHED_NORMAL + * SCHED_BATCH + * SCHED_FIFO + * SCHED_RR + */ +struct binder_priority { + unsigned int sched_policy; + int prio; }; enum { @@ -2841,10 +2858,6 @@ static int binder_proc_transaction(struct binder_transaction *t, } binder_inner_proc_lock(proc); - if (proc->is_frozen) { - proc->sync_recv |= !oneway; - proc->async_recv |= oneway; - } if ((proc->is_frozen && !oneway) || proc->is_dead || (thread && thread->is_dead)) { @@ -5200,8 +5213,6 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, if (!info->enable) { binder_inner_proc_lock(target_proc); - target_proc->sync_recv = false; - target_proc->async_recv = false; target_proc->is_frozen = false; binder_inner_proc_unlock(target_proc); return 0; @@ -5213,8 +5224,6 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, * for transactions to drain. */ binder_inner_proc_lock(target_proc); - target_proc->sync_recv = false; - target_proc->async_recv = false; target_proc->is_frozen = true; binder_inner_proc_unlock(target_proc); @@ -5236,33 +5245,6 @@ static int binder_ioctl_freeze(struct binder_freeze_info *info, return ret; } -static int binder_ioctl_get_freezer_info( - struct binder_frozen_status_info *info) -{ - struct binder_proc *target_proc; - bool found = false; - - info->sync_recv = 0; - info->async_recv = 0; - - mutex_lock(&binder_procs_lock); - hlist_for_each_entry(target_proc, &binder_procs, proc_node) { - if (target_proc->pid == info->pid) { - found = true; - binder_inner_proc_lock(target_proc); - info->sync_recv |= target_proc->sync_recv; - info->async_recv |= target_proc->async_recv; - binder_inner_proc_unlock(target_proc); - } - } - mutex_unlock(&binder_procs_lock); - - if (!found) - return -EINVAL; - - return 0; -} - static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { int ret; @@ -5441,24 +5423,6 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) goto err; break; } - case BINDER_GET_FROZEN_INFO: { - struct binder_frozen_status_info info; - - if (copy_from_user(&info, ubuf, sizeof(info))) { - ret = -EFAULT; - goto err; - } - - ret = binder_ioctl_get_freezer_info(&info); - if (ret < 0) - goto err; - - if (copy_to_user(ubuf, &info, sizeof(info))) { - ret = -EFAULT; - goto err; - } - break; - } default: ret = -EINVAL; goto err; @@ -5789,8 +5753,6 @@ static void binder_deferred_release(struct binder_proc *proc) proc->is_dead = true; proc->is_frozen = false; - proc->sync_recv = false; - proc->async_recv = false; threads = 0; active_transactions = 0; while ((n = rb_first(&proc->threads))) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index 18b72abd3f2e..5f0b2121fce5 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -403,10 +403,6 @@ enum binder_prio_state { * @is_frozen: process is frozen and unable to service * binder transactions * (protected by @inner_lock) - * @sync_recv: process received sync transactions since last frozen - * (protected by @inner_lock) - * @async_recv: process received async transactions since last frozen - * (protected by @inner_lock) * @freeze_wait: waitqueue of processes waiting for all outstanding * transactions to be processed * (protected by @inner_lock) @@ -453,8 +449,6 @@ struct binder_proc { int outstanding_txns; bool is_dead; bool is_frozen; - bool sync_recv; - bool async_recv; wait_queue_head_t freeze_wait; struct list_head todo; diff --git a/include/uapi/linux/android/binder.h b/include/uapi/linux/android/binder.h index 926b05cf8e2c..88c99a1abc5d 100644 --- a/include/uapi/linux/android/binder.h +++ b/include/uapi/linux/android/binder.h @@ -271,12 +271,6 @@ struct binder_freeze_info { __u32 timeout_ms; }; -struct binder_frozen_status_info { - __u32 pid; - __u32 sync_recv; - __u32 async_recv; -}; - #define BINDER_WRITE_READ _IOWR('b', 1, struct binder_write_read) #define BINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64) #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32) @@ -288,7 +282,6 @@ struct binder_frozen_status_info { #define BINDER_GET_NODE_INFO_FOR_REF _IOWR('b', 12, struct binder_node_info_for_ref) #define BINDER_SET_CONTEXT_MGR_EXT _IOW('b', 13, struct flat_binder_object) #define BINDER_FREEZE _IOW('b', 14, struct binder_freeze_info) -#define BINDER_GET_FROZEN_INFO _IOWR('b', 15, struct binder_frozen_status_info) /* * NOTE: Two special error codes you should check for when calling