Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build with vendor/pineapple_GKI.config #3

Open
epudwjuhc opened this issue Jan 16, 2025 · 9 comments
Open

Does not build with vendor/pineapple_GKI.config #3

epudwjuhc opened this issue Jan 16, 2025 · 9 comments

Comments

@epudwjuhc
Copy link

won't compile dumps myriads of errors...

kernel/oplus_cpu/sched/sched_assist/sched_assist.c:37:2: error: implicit declaration of function 'register_trace_android_rvh_place_entity' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
REGISTER_TRACE_RVH(android_rvh_place_entity, android_rvh_place_entity_handler);
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:54:1: note: expanded from here
register_trace_android_rvh_place_entity
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:37:2: note: did you mean 'trace_android_rvh_place_entity'?
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:54:1: note: expanded from here
register_trace_android_rvh_place_entity
^
./include/trace/hooks/sched.h:189:1: note: 'trace_android_rvh_place_entity' declared here
DECLARE_RESTRICTED_HOOK(android_rvh_place_entity,
^
./include/trace/hooks/vendor_hooks.h:121:2: note: expanded from macro 'DECLARE_RESTRICTED_HOOK'
DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:95:1: note: expanded from here
trace_android_rvh_place_entity
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:38:2: error: implicit declaration of function 'register_trace_android_rvh_pick_next_entity' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
REGISTER_TRACE_RVH(android_rvh_pick_next_entity, android_rvh_pick_next_entity_handler);
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:56:1: note: expanded from here
register_trace_android_rvh_pick_next_entity
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:38:2: note: did you mean 'trace_android_rvh_pick_next_entity'?
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:56:1: note: expanded from here
register_trace_android_rvh_pick_next_entity
^
./include/trace/hooks/sched.h:250:1: note: 'trace_android_rvh_pick_next_entity' declared here
DECLARE_RESTRICTED_HOOK(android_rvh_pick_next_entity,
^
./include/trace/hooks/vendor_hooks.h:121:2: note: expanded from macro 'DECLARE_RESTRICTED_HOOK'
DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:33:1: note: expanded from here
trace_android_rvh_pick_next_entity
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:39:2: error: implicit declaration of function 'register_trace_android_rvh_can_migrate_task' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
REGISTER_TRACE_RVH(android_rvh_can_migrate_task, android_rvh_can_migrate_task_handler);
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:58:1: note: expanded from here
register_trace_android_rvh_can_migrate_task
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:39:2: note: did you mean 'trace_android_rvh_can_migrate_task'?
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:58:1: note: expanded from here
register_trace_android_rvh_can_migrate_task
^
./include/trace/hooks/sched.h:38:1: note: 'trace_android_rvh_can_migrate_task' declared here
DECLARE_RESTRICTED_HOOK(android_rvh_can_migrate_task,
^
./include/trace/hooks/vendor_hooks.h:121:2: note: expanded from macro 'DECLARE_RESTRICTED_HOOK'
DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:125:1: note: expanded from here
trace_android_rvh_can_migrate_task
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:46:2: error: implicit declaration of function 'register_trace_android_rvh_enqueue_entity' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
REGISTER_TRACE_RVH(android_rvh_enqueue_entity, android_rvh_enqueue_entity_handler);
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:60:1: note: expanded from here
register_trace_android_rvh_enqueue_entity
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:46:2: note: did you mean 'trace_android_rvh_enqueue_entity'?
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:60:1: note: expanded from here
register_trace_android_rvh_enqueue_entity
^
./include/trace/hooks/sched.h:301:1: note: 'trace_android_rvh_enqueue_entity' declared here
DECLARE_RESTRICTED_HOOK(android_rvh_enqueue_entity,
^
./include/trace/hooks/vendor_hooks.h:121:2: note: expanded from macro 'DECLARE_RESTRICTED_HOOK'
DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:63:1: note: expanded from here
trace_android_rvh_enqueue_entity
^
kernel/oplus_cpu/sched/task_cpustats/task_cpustats.c:350:7: error: implicit declaration of function 'register_trace_android_vh_account_task_time' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rc = register_trace_android_vh_account_task_time(account_task_time_handler, NULL);
^
kernel/oplus_cpu/sched/task_cpustats/task_cpustats.c:350:7: note: did you mean 'trace_android_vh_account_task_time'?
./include/trace/hooks/sched.h:385:1: note: 'trace_android_vh_account_task_time' declared here
DECLARE_HOOK(android_vh_account_task_time,
^
./include/trace/hooks/vendor_hooks.h:119:22: note: expanded from macro 'DECLARE_HOOK'
#define DECLARE_HOOK DECLARE_EVENT_NOP
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:96:1: note: expanded from here
trace_android_vh_account_task_time
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:47:2: error: implicit declaration of function 'register_trace_android_rvh_dequeue_entity' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
REGISTER_TRACE_RVH(android_rvh_dequeue_entity, android_rvh_dequeue_entity_handler);
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:62:1: note: expanded from here
register_trace_android_rvh_dequeue_entity
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.c:47:2: note: did you mean 'trace_android_rvh_dequeue_entity'?
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:28:29: note: expanded from macro 'REGISTER_TRACE_RVH'
#define REGISTER_TRACE_RVH REGISTER_TRACE_VH
^
kernel/oplus_cpu/sched/sched_assist/sched_assist.h:16:9: note: expanded from macro 'REGISTER_TRACE_VH'
ret = register_trace_##vender_hook(handler, NULL);
^
:62:1: note: expanded from here
register_trace_android_rvh_dequeue_entity
^
./include/trace/hooks/sched.h:305:1: note: 'trace_android_rvh_dequeue_entity' declared here
DECLARE_RESTRICTED_HOOK(android_rvh_dequeue_entity,
^
./include/trace/hooks/vendor_hooks.h:121:2: note: expanded from macro 'DECLARE_RESTRICTED_HOOK'
DECLARE_EVENT_NOP(name, PARAMS(proto), PARAMS(args))
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:66:1: note: expanded from here
trace_android_rvh_dequeue_entity
^
kernel/oplus_cpu/sched/task_cpustats/task_cpustats.c:379:7: error: implicit declaration of function 'unregister_trace_android_vh_account_task_time' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
rc = unregister_trace_android_vh_account_task_time(account_task_time_handler, NULL);
^
kernel/oplus_cpu/sched/task_cpustats/task_cpustats.c:379:7: note: did you mean 'trace_android_vh_account_task_time'?
./include/trace/hooks/sched.h:385:1: note: 'trace_android_vh_account_task_time' declared here
DECLARE_HOOK(android_vh_account_task_time,
^
./include/trace/hooks/vendor_hooks.h:119:22: note: expanded from macro 'DECLARE_HOOK'
#define DECLARE_HOOK DECLARE_EVENT_NOP
^
./include/linux/tracepoint.h:568:21: note: expanded from macro 'DECLARE_EVENT_NOP'
static inline void trace_##name(proto)
^
:96:1: note: expanded from here
trace_android_vh_account_task_time
^
2 errors generated.

.... and so on

RealJohnGalt pushed a commit to RealJohnGalt/kernel_common_oneplus_sm8650 that referenced this issue Jan 20, 2025
[ Upstream commit 953e549471cabc9d4980f1da2e9fa79f4c23da06 ]

Lockdep gives a false positive splat as it can't distinguish the lock
which is taken by different IRQ descriptors from different IRQ chips
that are organized in a way of a hierarchy:

   ======================================================
   WARNING: possible circular locking dependency detected
   6.12.0-rc5-next-20241101-00148-g9fabf8160b53 #562 Tainted: G        W
   ------------------------------------------------------
   modprobe/141 is trying to acquire lock:
   ffff899446947868 (intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock){+.+.}-{4:4}, at: regmap_update_bits_base+0x33/0x90

   but task is already holding lock:
   ffff899446947c68 (&d->lock){+.+.}-{4:4}, at: __setup_irq+0x682/0x790

   which lock already depends on the new lock.

   -> OnePlusOSS#3 (&d->lock){+.+.}-{4:4}:
   -> OnePlusOSS#2 (&desc->request_mutex){+.+.}-{4:4}:
   -> OnePlusOSS#1 (ipclock){+.+.}-{4:4}:
   -> #0 (intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock){+.+.}-{4:4}:

   Chain exists of:
     intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock --> &desc->request_mutex --> &d->lock

    Possible unsafe locking scenario:

          CPU0                    CPU1
          ----                    ----
     lock(&d->lock);
                                  lock(&desc->request_mutex);
                                  lock(&d->lock);
     lock(intel_soc_pmic_bxtwc:502:(&bxtwc_regmap_config)->lock);

    *** DEADLOCK ***

   3 locks held by modprobe/141:
    #0: ffff8994419368f8 (&dev->mutex){....}-{4:4}, at: __driver_attach+0xf6/0x250
    OnePlusOSS#1: ffff89944690b250 (&desc->request_mutex){+.+.}-{4:4}, at: __setup_irq+0x1a2/0x790
    OnePlusOSS#2: ffff899446947c68 (&d->lock){+.+.}-{4:4}, at: __setup_irq+0x682/0x790

Set a lockdep class when we map the IRQ so that it doesn't warn about
a lockdep bug that doesn't exist.

Fixes: 4af8be6 ("regmap: Convert regmap_irq to use irq_domain")
Signed-off-by: Andy Shevchenko <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
RealJohnGalt pushed a commit to RealJohnGalt/kernel_common_oneplus_sm8650 that referenced this issue Jan 20, 2025
[ Upstream commit 59458fa4ddb47e7891c61b4a928d13d5f5b00aa0 ]

Ran Xiaokai reports that with a KCSAN-enabled PREEMPT_RT kernel, we can see
splats like:

| BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
| in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1
| preempt_count: 10002, expected: 0
| RCU nest depth: 0, expected: 0
| no locks held by swapper/1/0.
| irq event stamp: 156674
| hardirqs last  enabled at (156673): [<ffffffff81130bd9>] do_idle+0x1f9/0x240
| hardirqs last disabled at (156674): [<ffffffff82254f84>] sysvec_apic_timer_interrupt+0x14/0xc0
| softirqs last  enabled at (0): [<ffffffff81099f47>] copy_process+0xfc7/0x4b60
| softirqs last disabled at (0): [<0000000000000000>] 0x0
| Preemption disabled at:
| [<ffffffff814a3e2a>] paint_ptr+0x2a/0x90
| CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.11.0+ OnePlusOSS#3
| Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014
| Call Trace:
|  <IRQ>
|  dump_stack_lvl+0x7e/0xc0
|  dump_stack+0x1d/0x30
|  __might_resched+0x1a2/0x270
|  rt_spin_lock+0x68/0x170
|  kcsan_skip_report_debugfs+0x43/0xe0
|  print_report+0xb5/0x590
|  kcsan_report_known_origin+0x1b1/0x1d0
|  kcsan_setup_watchpoint+0x348/0x650
|  __tsan_unaligned_write1+0x16d/0x1d0
|  hrtimer_interrupt+0x3d6/0x430
|  __sysvec_apic_timer_interrupt+0xe8/0x3a0
|  sysvec_apic_timer_interrupt+0x97/0xc0
|  </IRQ>

On a detected data race, KCSAN's reporting logic checks if it should
filter the report. That list is protected by the report_filterlist_lock
*non-raw* spinlock which may sleep on RT kernels.

Since KCSAN may report data races in any context, convert it to a
raw_spinlock.

This requires being careful about when to allocate memory for the filter
list itself which can be done via KCSAN's debugfs interface. Concurrent
modification of the filter list via debugfs should be rare: the chosen
strategy is to optimistically pre-allocate memory before the critical
section and discard if unused.

Link: https://lore.kernel.org/all/[email protected]/
Reported-by: Ran Xiaokai <[email protected]>
Tested-by: Ran Xiaokai <[email protected]>
Signed-off-by: Marco Elver <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
RealJohnGalt pushed a commit to RealJohnGalt/kernel_common_oneplus_sm8650 that referenced this issue Jan 20, 2025
[ Upstream commit 4d94f05558271654670d18c26c912da0c1c15549 ]

This reworks hci_cb_list to not use mutex hci_cb_list_lock to avoid bugs
like the bellow:

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585
in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5070, name: kworker/u9:2
preempt_count: 0, expected: 0
RCU nest depth: 1, expected: 0
4 locks held by kworker/u9:2/5070:
 #0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3229 [inline]
 #0: ffff888015be3948 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_scheduled_works+0x8e0/0x1770 kernel/workqueue.c:3335
 OnePlusOSS#1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3230 [inline]
 OnePlusOSS#1: ffffc90003b6fd00 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_scheduled_works+0x91b/0x1770 kernel/workqueue.c:3335
 OnePlusOSS#2: ffff8880665d0078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xcf/0xae0 net/bluetooth/hci_event.c:6914
 OnePlusOSS#3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:298 [inline]
 OnePlusOSS#3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:750 [inline]
 OnePlusOSS#3: ffffffff8e132020 (rcu_read_lock){....}-{1:2}, at: hci_le_create_big_complete_evt+0xdb/0xae0 net/bluetooth/hci_event.c:6915
CPU: 0 PID: 5070 Comm: kworker/u9:2 Not tainted 6.8.0-syzkaller-08073-g480e035fc4c7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci0 hci_rx_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 __might_resched+0x5d4/0x780 kernel/sched/core.c:10187
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0xc1/0xd70 kernel/locking/mutex.c:752
 hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline]
 hci_le_create_big_complete_evt+0x3d9/0xae0 net/bluetooth/hci_event.c:6939
 hci_event_func net/bluetooth/hci_event.c:7514 [inline]
 hci_event_packet+0xa53/0x1540 net/bluetooth/hci_event.c:7569
 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4171
 process_one_work kernel/workqueue.c:3254 [inline]
 process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335
 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416
 kthread+0x2f0/0x390 kernel/kthread.c:388
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243
 </TASK>

Reported-by: [email protected]
Tested-by: [email protected]
Closes: https://syzkaller.appspot.com/bug?extid=2fb0835e0c9cefc34614
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
RealJohnGalt pushed a commit to RealJohnGalt/kernel_common_oneplus_sm8650 that referenced this issue Jan 20, 2025
…le_direct_reclaim()

commit 6aaced5abd32e2a57cd94fd64f824514d0361da8 upstream.

The task sometimes continues looping in throttle_direct_reclaim() because
allow_direct_reclaim(pgdat) keeps returning false.

 #0 [ffff80002cb6f8d0] __switch_to at ffff8000080095ac
 OnePlusOSS#1 [ffff80002cb6f900] __schedule at ffff800008abbd1c
 OnePlusOSS#2 [ffff80002cb6f990] schedule at ffff800008abc50c
 OnePlusOSS#3 [ffff80002cb6f9b0] throttle_direct_reclaim at ffff800008273550
 #4 [ffff80002cb6fa20] try_to_free_pages at ffff800008277b68
 #5 [ffff80002cb6fae0] __alloc_pages_nodemask at ffff8000082c4660
 #6 [ffff80002cb6fc50] alloc_pages_vma at ffff8000082e4a98
 #7 [ffff80002cb6fca0] do_anonymous_page at ffff80000829f5a8
 #8 [ffff80002cb6fce0] __handle_mm_fault at ffff8000082a5974
 #9 [ffff80002cb6fd90] handle_mm_fault at ffff8000082a5bd4

At this point, the pgdat contains the following two zones:

        NODE: 4  ZONE: 0  ADDR: ffff00817fffe540  NAME: "DMA32"
          SIZE: 20480  MIN/LOW/HIGH: 11/28/45
          VM_STAT:
                NR_FREE_PAGES: 359
        NR_ZONE_INACTIVE_ANON: 18813
          NR_ZONE_ACTIVE_ANON: 0
        NR_ZONE_INACTIVE_FILE: 50
          NR_ZONE_ACTIVE_FILE: 0
          NR_ZONE_UNEVICTABLE: 0
        NR_ZONE_WRITE_PENDING: 0
                     NR_MLOCK: 0
                    NR_BOUNCE: 0
                   NR_ZSPAGES: 0
            NR_FREE_CMA_PAGES: 0

        NODE: 4  ZONE: 1  ADDR: ffff00817fffec00  NAME: "Normal"
          SIZE: 8454144  PRESENT: 98304  MIN/LOW/HIGH: 68/166/264
          VM_STAT:
                NR_FREE_PAGES: 146
        NR_ZONE_INACTIVE_ANON: 94668
          NR_ZONE_ACTIVE_ANON: 3
        NR_ZONE_INACTIVE_FILE: 735
          NR_ZONE_ACTIVE_FILE: 78
          NR_ZONE_UNEVICTABLE: 0
        NR_ZONE_WRITE_PENDING: 0
                     NR_MLOCK: 0
                    NR_BOUNCE: 0
                   NR_ZSPAGES: 0
            NR_FREE_CMA_PAGES: 0

In allow_direct_reclaim(), while processing ZONE_DMA32, the sum of
inactive/active file-backed pages calculated in zone_reclaimable_pages()
based on the result of zone_page_state_snapshot() is zero.

Additionally, since this system lacks swap, the calculation of inactive/
active anonymous pages is skipped.

        crash> p nr_swap_pages
        nr_swap_pages = $1937 = {
          counter = 0
        }

As a result, ZONE_DMA32 is deemed unreclaimable and skipped, moving on to
the processing of the next zone, ZONE_NORMAL, despite ZONE_DMA32 having
free pages significantly exceeding the high watermark.

The problem is that the pgdat->kswapd_failures hasn't been incremented.

        crash> px ((struct pglist_data *) 0xffff00817fffe540)->kswapd_failures
        $1935 = 0x0

This is because the node deemed balanced.  The node balancing logic in
balance_pgdat() evaluates all zones collectively.  If one or more zones
(e.g., ZONE_DMA32) have enough free pages to meet their watermarks, the
entire node is deemed balanced.  This causes balance_pgdat() to exit early
before incrementing the kswapd_failures, as it considers the overall
memory state acceptable, even though some zones (like ZONE_NORMAL) remain
under significant pressure.


The patch ensures that zone_reclaimable_pages() includes free pages
(NR_FREE_PAGES) in its calculation when no other reclaimable pages are
available (e.g., file-backed or anonymous pages).  This change prevents
zones like ZONE_DMA32, which have sufficient free pages, from being
mistakenly deemed unreclaimable.  By doing so, the patch ensures proper
node balancing, avoids masking pressure on other zones like ZONE_NORMAL,
and prevents infinite loops in throttle_direct_reclaim() caused by
allow_direct_reclaim(pgdat) repeatedly returning false.


The kernel hangs due to a task stuck in throttle_direct_reclaim(), caused
by a node being incorrectly deemed balanced despite pressure in certain
zones, such as ZONE_NORMAL.  This issue arises from
zone_reclaimable_pages() returning 0 for zones without reclaimable file-
backed or anonymous pages, causing zones like ZONE_DMA32 with sufficient
free pages to be skipped.

The lack of swap or reclaimable pages results in ZONE_DMA32 being ignored
during reclaim, masking pressure in other zones.  Consequently,
pgdat->kswapd_failures remains 0 in balance_pgdat(), preventing fallback
mechanisms in allow_direct_reclaim() from being triggered, leading to an
infinite loop in throttle_direct_reclaim().

This patch modifies zone_reclaimable_pages() to account for free pages
(NR_FREE_PAGES) when no other reclaimable pages exist.  This ensures zones
with sufficient free pages are not skipped, enabling proper balancing and
reclaim behavior.

[[email protected]: coding-style cleanups]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 5a1c84b ("mm: remove reclaim and compaction retry approximations")
Signed-off-by: Seiji Nishikawa <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
@OnePlusOSSAdmin
Copy link
Contributor

Do you use the build command as we provide? https://github.com/OnePlusOSS/kernel_manifest/tree/oneplus/sm8650
If so, you could provide detailed log then we check what we could do for you.
If not. sorry that we couldn't provide help.

@epudwjuhc
Copy link
Author

I just started over with a clean clone of [android_kernel_modules_and_devicetree_oneplus_sm8650], then do:

android_kernel_modules_and_devicetree_oneplus_sm8650> ./kernel_platform/oplus/build/oplus_build.sh

this prints out:

build help
./kernel_platform/oplus/build/oplus_build.sh waipio consolidate thin all true 2>&1 |tee build.log

userdebug build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple consolidate
user build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple gki


select platform:
   1.  pineapple
   2.  reserve

New Platform need add to here 
Which would you like? [pineapple]pineapple

now default auto select platform pineapple 

Select Build Type:
   1.  consolidate/userdebug
   2.  gki/user
   you can select 
Which build type would you like? [gki] 

variants_type gki 
start date:2025_01_24 19:07:34
.....
......stuff....
....
ANDROID_BUILD_TOP is not set. Have you run lunch yet?

so, how is it supposed to be run? I need to clone it into a prior clone of [android_kernel_oneplus_sm8650] or prior clone of AOSP, or how is it supposed to work?

Maybe you can provide clearer instructions what repo(s) need to be cloned and in which order?

thanks

@543069760
Copy link

我刚从 [android_kernel_modules_and_devicetree_oneplus_sm8650] 的干净克隆重新开始,然后执行以下操作:

android_kernel_modules_and_devicetree_oneplus_sm8650> ./kernel_platform/oplus/build/oplus_build.sh

这将打印出:

build help
./kernel_platform/oplus/build/oplus_build.sh waipio consolidate thin all true 2>&1 |tee build.log

userdebug build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple consolidate
user build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple gki


select platform:
   1.  pineapple
   2.  reserve

New Platform need add to here 
Which would you like? [pineapple]pineapple

now default auto select platform pineapple 

Select Build Type:
   1.  consolidate/userdebug
   2.  gki/user
   you can select 
Which build type would you like? [gki] 

variants_type gki 
start date:2025_01_24 19:07:34
.....
......stuff....
....
ANDROID_BUILD_TOP is not set. Have you run lunch yet?

那么,它应该如何运行呢?我需要将其克隆到 [android_kernel_oneplus_sm8650] 的先前克隆或 AOSP 的先前克隆中,或者它应该如何工作?

也许您可以提供更清晰的说明,哪些存储库需要克隆以及以什么顺序克隆?

谢谢

我刚从 [android_kernel_modules_and_devicetree_oneplus_sm8650] 的干净克隆重新开始,然后执行以下操作:

android_kernel_modules_and_devicetree_oneplus_sm8650> ./kernel_platform/oplus/build/oplus_build.sh

这将打印出:

build help
./kernel_platform/oplus/build/oplus_build.sh waipio consolidate thin all true 2>&1 |tee build.log

userdebug build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple consolidate
user build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple gki


select platform:
   1.  pineapple
   2.  reserve

New Platform need add to here 
Which would you like? [pineapple]pineapple

now default auto select platform pineapple 

Select Build Type:
   1.  consolidate/userdebug
   2.  gki/user
   you can select 
Which build type would you like? [gki] 

variants_type gki 
start date:2025_01_24 19:07:34
.....
......stuff....
....
ANDROID_BUILD_TOP is not set. Have you run lunch yet?

那么,它应该如何运行呢?我需要将其克隆到 [android_kernel_oneplus_sm8650] 的先前克隆或 AOSP 的先前克隆中,或者它应该如何工作?

也许您可以提供更清晰的说明,哪些存储库需要克隆以及以什么顺序克隆?

谢谢

目前也是同样的问题:
Actions如下:
name: Build Kernel
on:
workflow_dispatch:
inputs:
CPUD:
description: "处理器代号"
required: true
default: 'pineapple'

jobs:
build:
runs-on: ubuntu-latest

steps:
  - name: Check Out
    uses: actions/checkout@v3
    
  - name: Cleanup
    uses: rokibhasansagar/slimhub_actions@main

  - name: Configure Git
    run: |
     git config --global user.name "wuua"
     git config --global user.email "[email protected]"

  - name: Clean up disk space
    run: |
     sudo apt-get clean
     sudo rm -rf /usr/share/dotnet /etc/mysql /var/lib/mysql
     sudo rm -rf /usr/local/lib/android
     df -h
    
  - name: Install dependencies
    run: |
     sudo apt update && sudo apt upgrade -y
     sudo apt install -y python3 git curl

  - name: Clone kernel repositories
    run: |
     mkdir -p kernel_workspace/msm-kernel
     mkdir -p kernel_workspace/common
     mkdir -p kernel_workspace/modules_and_devicetree
     
     cd kernel_workspace/msm-kernel
     git clone https://github.com/OnePlusOSS/android_kernel_oneplus_sm8650.git -b oneplus/sm8650_v_15.0.0_oneplus_ace5 .
     
     cd ../common
     git clone https://github.com/OnePlusOSS/android_kernel_common_oneplus_sm8650.git -b oneplus/sm8650_v_15.0.0_oneplus_ace5 .
     
     cd ../modules_and_devicetree
     git clone https://github.com/OnePlusOSS/android_kernel_modules_and_devicetree_oneplus_sm8650.git -b oneplus/sm8650_v_15.0.0_oneplus_ace5 .

  - name: List cloned repositories content
    run: |
     ls -laR kernel_workspace/msm-kernel
     ls -laR kernel_workspace/common
     ls -laR kernel_workspace/modules_and_devicetree
    
  - name: Prepare build environment
    run: |
     cd kernel_workspace/modules_and_devicetree/kernel_platform/oplus/build
     pwd
     ls -l .
     source oplus_setup.sh ${{ github.event.inputs.CPUD }} gki
     init_build_environment

  - name: Build kernel
    run: |
     cd kernel_workspace/modules_and_devicetree/kernel_platform/oplus/build
     ./oplus_build_kernel.sh ${{ github.event.inputs.CPUD }} gki

  - name: Make AnyKernel3
    run: |
     git clone https://github.com/Kernel-SU/AnyKernel3 --depth=1
     rm -rf ./AnyKernel3/.git
     cp kernel_workspace/modules_and_devicetree/out/msm-kernel-${{ github.event.inputs.CPUD }}-gki/dist/Image ./AnyKernel3/

  - name: Upload AnyKernel3
    uses: actions/upload-artifact@v4
    with:
     name: AnyKernel3_KernelSU_Next_${{ env.KSUVER }}_${{ github.event.inputs.FEIL }}
     path: ./AnyKernel3/*

  - name: Upload boot.img
    uses: actions/upload-artifact@v4
    with:
     name: boot_KernelSU_Next_${{ env.KSUVER }}_${{ github.event.inputs.FEIL }}
     path: kernel_workspace/modules_and_devicetree/out/msm-kernel-${{ github.event.inputs.CPUD }}-gki/dist/boot.img

错误日志如下:

Run cd kernel_workspace/modules_and_devicetree/kernel_platform/oplus/build
cd kernel_workspace/modules_and_devicetree/kernel_platform/oplus/build
pwd
ls -l .
source oplus_setup.sh pineapple gki
init_build_environment
shell: /usr/bin/bash -e {0}
/home/runner/work/Action-KerneXXX/Action-KernelXXX/kernel_workspace/modules_and_devicetree/kernel_platform/oplus/build
total 76
drwxr-xr-x 2 runner docker 4096 Jan 25 16:57 bazel_wrapper
-rwxr-xr-x 1 runner docker 1544 Jan 25 16:57 check_module_list_tool.py
-rwxr-xr-x 1 runner docker 12155 Jan 25 16:57 oplus_build.sh
-rwxr-xr-x 1 runner docker 709 Jan 25 16:57 oplus_build_dtbo.sh
-rwxr-xr-x 1 runner docker 576 Jan 25 16:57 oplus_build_kernel.sh
-rwxr-xr-x 1 runner docker 2669 Jan 25 16:57 oplus_build_module.sh
-rwxr-xr-x 1 runner docker 4331 Jan 25 16:57 oplus_build_repack_bootimg.sh
-rwxr-xr-x 1 runner docker 20572 Jan 25 16:57 oplus_rebuild_img.sh
-rwxr-xr-x 1 runner docker 10411 Jan 25 16:57 oplus_setup.sh
userdebug build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple consolidate
user build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple gki

select platform:

  1. pineapple
  2. reserve

New Platform need add to here
Which would you like? [pineapple]pineapple

now default auto select platform pineapple

Select Build Type:

  1. consolidate/userdebug
  2. gki/user
    you can select
    Which build type would you like? [gki] gki

variants_type gki
oplus_setup.sh: line 12: vendor/oplus/kernel/prebuilt/vendorsetup.sh: No such file or directory
Error: Process completed with exit code 1.

按照文档 ./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple gki 操作的

@OnePlusOSSAdmin
Copy link
Contributor

1, use repo to download code, or make sure you get fulle code and place them with expected directory structure.
change xml name as your device

repo init -u https://github.com/OnePlusOSS/kernel_manifest -b oneplus/sm8650 -m oneplus_12_v.xml 
repo sync

2, @543069760 这个报错可以忽略,或者在代码中注释掉对应行,那个脚本的作用是创建软链接,释放代码中都已包含

oplus_setup.sh: line 12: vendor/oplus/kernel/prebuilt/vendorsetup.sh: No such file or directory
Error: Process completed with exit code 1.

@543069760
Copy link

1, use repo to download code, or make sure you get fulle code and place them with expected directory structure.
change xml name as your device

repo init -u https://github.com/OnePlusOSS/kernel_manifest -b oneplus/sm8650 -m oneplus_12_v.xml 
repo sync

2, @543069760 这个报错可以忽略,或者在代码中注释掉对应行,那个脚本的作用是创建软链接,释放代码中都已包含

oplus_setup.sh: line 12: vendor/oplus/kernel/prebuilt/vendorsetup.sh: No such file or directory
Error: Process completed with exit code 1.

感谢官方解答

@epudwjuhc
Copy link
Author

same thing here:

source oplus_setup.sh ${{ github.event.inputs.CPUD }} gki bash: ${{ github.event.inputs.CPUD }}: bad substitution

then:

init_build_environment bash: vendor/oplus/kernel/prebuilt/vendorsetup.sh: No such file or directory

@epudwjuhc
Copy link
Author

epudwjuhc commented Jan 28, 2025

repo init -u https://github.com/OnePlusOSS/kernel_manifest -b oneplus/sm8650 -m oneplus_12_v.xml
Downloading Repo source from https://gerrit.googlesource.com/git-repo
fatal: manifest 'oneplus_12_v.xml' not available
fatal: manifest oneplus_12_v.xml not found
================================================================================
Repo command failed: UpdateManifestError
        Unable to sync manifest oneplus_12_v.xml


are you sure this is the right command?

@epudwjuhc
Copy link
Author

maybe I missed to type:

sudo rm -rf /
?

@epudwjuhc
Copy link
Author

it does not create a build config file....

./kernel_platform/oplus/build/oplus_build_kernel.sh pineapple gki 
userdebug build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple consolidate
user build command
./kernel_platform/oplus/build/oplus_xxx_xxx.sh pineapple gki


select platform:
   1.  pineapple
   2.  reserve

New Platform need add to here 
Which would you like? [pineapple]pineapple

now default auto select platform pineapple 

Select Build Type:
   1.  consolidate/userdebug
   2.  gki/user
   you can select 
Which build type would you like? [gki] gki

variants_type gki 
start date:2025_01_28 18:50:02


  kernel platform root: /XXXX/modules_and_devicetree/kernel_platform
No configs found!
Exiting...

 kernel platform output: /XXXX/modules_and_devicetree/kernel_platform/out/msm-kernel-pineapple-gki
+ '[' '!' -e /XXXX/modules_and_devicetree/device/qcom/pineapple-kernel/Image ']'
+ COPY_NEEDED=1
+ '[' '!' -e /XXXX/modules_and_devicetree/device/qcom/pineapple-kernel/build.config ']'
+ COPY_NEEDED=1
+ '[' '!' -e /XXXX/modules_and_devicetree/kernel_platform/out/msm-kernel-pineapple-gki/dist/Image -a 1 == 1 ']'
+ RECOMPILE_KERNEL=1
+ set +x
cp: cannot stat '/XXXX/modules_and_devicetree/kernel_platform/build.config': No such file or directory

start date:2025_01_28 18:50:02
end date:2025_01_28 18:50:02
build total time:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants