Merge keystone/android12-5.10-keystone-qcom-release.39+ (21f0e2a) into msm-5.10

* refs/heads/tmp-21f0e2a:
  ANDROID: arm64: consolidate.fragment: Enable KUNIT_TEST
  ANDROID: GKI: Enable CONFIG_IOMMU_IO_PGTABLE_ARMV7S
  ANDROID: abi_gki_aarch64_qcom: Add kthread cgroup migration rvh symbol
  ANDROID: usb: gadget: Resolve NULL pointer dereference in composite_disconnect
  ANDROID: GKI: Kconfig.gki: enable CONFIG_HMM_MIRROR with HIDDEN GPU
  ANDROID: mm: page_pinner: skip marking failure on freeable pages
  ANDROID: mm: page_alloc: skip dump pages for freeable page
  ANDROID: mm, oom: add vendor hook to prevent oom panic
  FROMLIST: kthread: Fix kthread_mod_delayed_work vs kthread_cancel_delayed_work_sync race

Change-Id: I01d47b454d99e67a226146c3f8022d9f3c7bb46e
Signed-off-by: Ivaylo Georgiev <irgeorgiev@codeaurora.org>
This commit is contained in:
Ivaylo Georgiev 2021-05-31 00:41:20 -07:00
commit 2290f84c9e
12 changed files with 74 additions and 36 deletions

View File

@ -2397,6 +2397,7 @@
__traceiter_android_rvh_account_irq
__traceiter_android_rvh_build_perf_domains
__traceiter_android_rvh_can_migrate_task
__traceiter_android_rvh_cgroup_force_kthread_migration
__traceiter_android_rvh_check_preempt_wakeup
__traceiter_android_rvh_cpu_cgroup_attach
__traceiter_android_rvh_cpu_cgroup_online
@ -2483,6 +2484,7 @@
__tracepoint_android_rvh_account_irq
__tracepoint_android_rvh_build_perf_domains
__tracepoint_android_rvh_can_migrate_task
__tracepoint_android_rvh_cgroup_force_kthread_migration
__tracepoint_android_rvh_check_preempt_wakeup
__tracepoint_android_rvh_cpu_cgroup_attach
__tracepoint_android_rvh_cpu_cgroup_online

View File

@ -25,11 +25,20 @@ CONFIG_DEBUG_RWSEMS=y
CONFIG_DEBUG_SPINLOCK=y
# CONFIG_DPM_WATCHDOG is not set
CONFIG_DYNAMIC_DEBUG=y
# CONFIG_EXT4_KUNIT_TESTS is not set
# CONFIG_FIND_BIT_BENCHMARK is not set
CONFIG_GKI_HACKS_FOR_CONSOLIDATE=y
CONFIG_I2C_CHARDEV=y
# CONFIG_INTERVAL_TREE_TEST is not set
# CONFIG_KASAN_KUNIT_TEST is not set
# CONFIG_KFENCE_KUNIT_TEST is not set
# CONFIG_KPROBES_SANITY_TEST is not set
CONFIG_KUNIT=y
# CONFIG_KUNIT_ALL_TESTS is not set
CONFIG_KUNIT_DEBUGFS=y
# CONFIG_KUNIT_DRIVER_PE_TEST is not set
# CONFIG_KUNIT_EXAMPLE_TEST is not set
# CONFIG_KUNIT_TEST is not set
# CONFIG_LINEAR_RANGES_TEST is not set
# CONFIG_LIST_KUNIT_TEST is not set
# CONFIG_LKDTM is not set
@ -39,6 +48,7 @@ CONFIG_LOCKUP_DETECTOR=y
CONFIG_PID_IN_CONTEXTIDR=y
# CONFIG_PM_ADVANCED_DEBUG is not set
CONFIG_PM_DEBUG=y
# CONFIG_PM_QOS_KUNIT_TEST is not set
CONFIG_PM_SLEEP_DEBUG=y
# CONFIG_PM_TEST_SUSPEND is not set
CONFIG_PREEMPTIRQ_TRACEPOINTS=y

View File

@ -509,6 +509,7 @@ CONFIG_SUN4I_TIMER=y
CONFIG_MTK_TIMER=y
CONFIG_MAILBOX=y
CONFIG_IOMMU_LIMIT_IOVA_ALIGNMENT=y
CONFIG_IOMMU_IO_PGTABLE_ARMV7S=y
CONFIG_REMOTEPROC=y
CONFIG_REMOTEPROC_CDEV=y
CONFIG_RPMSG_CHAR=y

View File

@ -285,6 +285,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_of_i2c_get_board_info);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_dirty_limits);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_oom_check_panic);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_uninterruptible_tasks_dn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_blk_reset);

View File

@ -1572,36 +1572,6 @@ static int android_setup(struct usb_gadget *gadget,
return value;
}
static void android_disconnect(struct usb_gadget *gadget)
{
struct usb_composite_dev *cdev = get_gadget_data(gadget);
struct gadget_info *gi = container_of(cdev, struct gadget_info, cdev);
/* FIXME: There's a race between usb_gadget_udc_stop() which is likely
* to set the gadget driver to NULL in the udc driver and this drivers
* gadget disconnect fn which likely checks for the gadget driver to
* be a null ptr. It happens that unbind (doing set_gadget_data(NULL))
* is called before the gadget driver is set to NULL and the udc driver
* calls disconnect fn which results in cdev being a null ptr.
*/
if (cdev == NULL) {
WARN(1, "%s: gadget driver already disconnected\n", __func__);
return;
}
/* accessory HID support can be active while the
accessory function is not actually enabled,
so we need to inform it when we are disconnected.
*/
#ifdef CONFIG_USB_CONFIGFS_F_ACC
acc_disconnect();
#endif
gi->connected = 0;
schedule_work(&gi->work);
composite_disconnect(gadget);
}
#else // CONFIG_USB_CONFIGFS_UEVENT
static int configfs_composite_setup(struct usb_gadget *gadget,
@ -1629,6 +1599,8 @@ static int configfs_composite_setup(struct usb_gadget *gadget,
return ret;
}
#endif // CONFIG_USB_CONFIGFS_UEVENT
static void configfs_composite_disconnect(struct usb_gadget *gadget)
{
struct usb_composite_dev *cdev;
@ -1639,6 +1611,14 @@ static void configfs_composite_disconnect(struct usb_gadget *gadget)
if (!cdev)
return;
#ifdef CONFIG_USB_CONFIGFS_F_ACC
/*
* accessory HID support can be active while the
* accessory function is not actually enabled,
* so we need to inform it when we are disconnected.
*/
acc_disconnect();
#endif
gi = container_of(cdev, struct gadget_info, cdev);
spin_lock_irqsave(&gi->spinlock, flags);
cdev = get_gadget_data(gadget);
@ -1647,6 +1627,10 @@ static void configfs_composite_disconnect(struct usb_gadget *gadget)
return;
}
#ifdef CONFIG_USB_CONFIGFS_UEVENT
gi->connected = 0;
schedule_work(&gi->work);
#endif
composite_disconnect(gadget);
spin_unlock_irqrestore(&gi->spinlock, flags);
}
@ -1673,8 +1657,6 @@ static void configfs_composite_reset(struct usb_gadget *gadget)
spin_unlock_irqrestore(&gi->spinlock, flags);
}
#endif // CONFIG_USB_CONFIGFS_UEVENT
static void configfs_composite_suspend(struct usb_gadget *gadget)
{
struct usb_composite_dev *cdev;
@ -1725,13 +1707,11 @@ static const struct usb_gadget_driver configfs_driver_template = {
#ifdef CONFIG_USB_CONFIGFS_UEVENT
.setup = android_setup,
.reset = android_disconnect,
.disconnect = android_disconnect,
#else
.setup = configfs_composite_setup,
#endif
.reset = configfs_composite_reset,
.disconnect = configfs_composite_disconnect,
#endif
.suspend = configfs_composite_suspend,
.resume = configfs_composite_resume,

View File

@ -1023,6 +1023,7 @@ drivers/iommu/iommu-sysfs.c
drivers/iommu/iommu-traces.c
drivers/iommu/io-pgtable-arm.c
drivers/iommu/io-pgtable-arm.h
drivers/iommu/io-pgtable-arm-v7s.c
drivers/iommu/io-pgtable.c
drivers/iommu/iova.c
drivers/iommu/of_iommu.c
@ -2655,6 +2656,7 @@ include/linux/hidraw.h
include/linux/hid-roccat.h
include/linux/highmem.h
include/linux/highuid.h
include/linux/hmm.h
include/linux/hrtimer_defs.h
include/linux/hrtimer.h
include/linux/huge_mm.h
@ -4933,6 +4935,7 @@ mm/filemap.c
mm/frame_vector.c
mm/gup.c
mm/highmem.c
mm/hmm.c
mm/huge_memory.c
mm/init-mm.c
mm/internal.h

View File

@ -10,6 +10,7 @@
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/oom.h>
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
@ -78,6 +79,9 @@ DECLARE_HOOK(android_vh_mm_dirty_limits,
unsigned long nr_reclaimable, unsigned long pages_dirtied),
TP_ARGS(gdtc, strictlimit, dirty, bg_thresh,
nr_reclaimable, pages_dirtied));
DECLARE_HOOK(android_vh_oom_check_panic,
TP_PROTO(struct oom_control *oc, int *ret),
TP_ARGS(oc, ret));
DECLARE_HOOK(android_vh_save_vmalloc_stack,
TP_PROTO(unsigned long flags, struct vm_struct *vm),
TP_ARGS(flags, vm));

View File

@ -163,6 +163,8 @@ config GKI_HIDDEN_RPMSG_CONFIGS
config GKI_HIDDEN_GPU_CONFIGS
bool "Hidden GPU configuration needed for GKI"
select TRACE_GPU_MEM
select MMU_NOTIFIER
select HMM_MIRROR
help
Dummy config option used to enable the hidden GPU config.
These are normally selected implicitly when a module

View File

@ -1139,6 +1139,19 @@ bool kthread_mod_delayed_work(struct kthread_worker *worker,
goto out;
ret = __kthread_cancel_work(work, true, &flags);
/*
* Canceling could run in parallel from kthread_cancel_delayed_work_sync
* and change work's canceling count as the spinlock is released and regain
* in __kthread_cancel_work so we need to check the count again. Otherwise,
* we might incorrectly queue the dwork and further cause
* cancel_delayed_work_sync thread waiting for flush dwork endlessly.
*/
if (work->canceling) {
ret = false;
goto out;
}
fast_queue:
__kthread_queue_delayed_work(worker, dwork, delay);
out:

View File

@ -51,6 +51,9 @@
#define CREATE_TRACE_POINTS
#include <trace/events/oom.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/mm.h>
int sysctl_panic_on_oom;
int sysctl_oom_kill_allocating_task;
int sysctl_oom_dump_tasks = 1;
@ -1146,6 +1149,12 @@ bool out_of_memory(struct oom_control *oc)
select_bad_process(oc);
/* Found nothing?!?! */
if (!oc->chosen) {
int ret = false;
trace_android_vh_oom_check_panic(oc, &ret);
if (ret)
return true;
dump_header(oc, NULL);
pr_warn("Out of memory and no killable processes...\n");
/*

View File

@ -8546,10 +8546,20 @@ static void alloc_contig_dump_pages(struct list_head *page_list)
if (DYNAMIC_DEBUG_BRANCH(descriptor)) {
struct page *page;
unsigned long nr_skip = 0;
unsigned long nr_pages = 0;
dump_stack();
list_for_each_entry(page, page_list, lru)
list_for_each_entry(page, page_list, lru) {
nr_pages++;
/* The page will be freed by putback_movable_pages soon */
if (page_count(page) == 1) {
nr_skip++;
continue;
}
dump_page(page, "migration failure");
}
pr_warn("total dump_pages %u skipping %u\n", nr_pages, nr_skip);
}
}
#else

View File

@ -334,6 +334,9 @@ void __page_pinner_mark_migration_failed_pages(struct list_head *page_list)
struct page_ext *page_ext;
list_for_each_entry(page, page_list, lru) {
/* The page will be freed by putback_movable_pages soon */
if (page_count(page) == 1)
continue;
page_ext = lookup_page_ext(page);
if (unlikely(!page_ext))
continue;