This reverts commit 67692435c4
temporarily in order to avoid the following splat:
[ 222.515957] BUG: kernel NULL pointer dereference, address: 0000000000000040
[ 222.518871] #PF: supervisor read access in kernel mode
[ 222.518871] #PF: error_code(0x0000) - not-present page
[ 222.518871] PGD 800000007cdf7067 P4D 800000007cdf7067 PUD 7c868067 PMD 0
[ 222.518871] Oops: 0000 [#1] PREEMPT SMP PTI
[ 222.518871] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.4.0-rc4-mainline-g6a9b34166c05 #1
[ 222.518871] Hardware name: ChromiumOS crosvm, BIOS 0
[ 222.518871] RIP: 0010:set_next_entity+0xf/0xf0
[ 222.518871] Code: 42 0b e5 85 31 c0 e8 90 1a fc ff 0f 0b eb 9b 66 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 53 48 89 f3 49 89 fe <83> 7e 40 00 74 3d 4c 89 f7 48 89 de e8 80 f9 ff ff 4c 8d 7b 18 4d
[ 222.518871] RSP: 0018:ffffb95040073de8 EFLAGS: 00010046
[ 222.518871] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff85ec0c30
[ 222.518871] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff9ec44c728500
[ 222.518871] RBP: ffffb95040073e00 R08: 0000000000000000 R09: 0000000000000000
[ 222.518871] R10: 0000000000000000 R11: ffffffff84ef0a30 R12: 0000000000000000
[ 222.518871] R13: 0000000000000000 R14: ffff9ec44c728500 R15: ffffb95040073e60
[ 222.518871] FS: 0000000000000000(0000) GS:ffff9ec44c700000(0000) knlGS:0000000000000000
[ 222.518871] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 222.518871] CR2: 0000000000000040 CR3: 000000007c87a002 CR4: 00000000003606e0
[ 222.518871] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 222.518871] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 222.518871] Call Trace:
[ 222.518871] pick_next_task_fair+0xe8/0x410
[ 222.518871] ? rcu_note_context_switch+0x3ef/0x520
[ 222.518871] ? finish_task_switch+0x10d/0x250
[ 222.518871] __schedule+0x1f8/0x6e0
[ 222.518871] schedule_idle+0x27/0x40
[ 222.518871] do_idle+0x21c/0x240
[ 222.518871] cpu_startup_entry+0x25/0x30
[ 222.518871] start_secondary+0x18d/0x1b0
[ 222.518871] secondary_startup_64+0xa4/0xb0
[ 222.518871] Modules linked in: vmw_vsock_virtio_transport vmw_vsock_virtio_transport_common vsock_diag vsock can_raw can snd_intel8x0 snd_ac97_codec ac97_bus virtio_input virtio_pci virtio_mmio virtio_crypto mmc_block mmc_core dummy_cpufreq rtc_test dummy_hcd can_dev vcan virtio_net net_failover failover virt_wifi virtio_blk virtio_gpu ttm virtio_rng virtio_ring virtio 8250_of crypto_engine
[ 222.518871] CR2: 0000000000000040
[ 222.518871] ---[ end trace ae741809965b22f2 ]---
[ 222.518871] RIP: 0010:set_next_entity+0xf/0xf0
[ 222.518871] Code: 42 0b e5 85 31 c0 e8 90 1a fc ff 0f 0b eb 9b 66 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 53 48 89 f3 49 89 fe <83> 7e 40 00 74 3d 4c 89 f7 48 89 de e8 80 f9 ff ff 4c 8d 7b 18 4d
[ 222.518871] RSP: 0018:ffffb95040073de8 EFLAGS: 00010046
[ 222.518871] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff85ec0c30
[ 222.518871] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff9ec44c728500
[ 222.518871] RBP: ffffb95040073e00 R08: 0000000000000000 R09: 0000000000000000
[ 222.518871] R10: 0000000000000000 R11: ffffffff84ef0a30 R12: 0000000000000000
[ 222.518871] R13: 0000000000000000 R14: ffff9ec44c728500 R15: ffffb95040073e60
[ 222.518871] FS: 0000000000000000(0000) GS:ffff9ec44c700000(0000) knlGS:0000000000000000
[ 222.518871] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 222.518871] CR2: 0000000000000040 CR3: 000000007c87a002 CR4: 00000000003606e0
[ 222.518871] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 222.518871] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 222.518871] Kernel panic - not syncing: Fatal exception
[ 222.518871] Kernel Offset: 0x3e00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
Bug: 142182814
Test: 20/20 avd/avd_boot_test_kernel_triggered passing
Signed-off-by: Quentin Perret <qperret@google.com>
Change-Id: I62bb09b4710fdc593cbf1f42bf4bbc066e401458
142 lines
3.2 KiB
C
142 lines
3.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* stop-task scheduling class.
|
|
*
|
|
* The stop task is the highest priority task in the system, it preempts
|
|
* everything and will be preempted by nothing.
|
|
*
|
|
* See kernel/stop_machine.c
|
|
*/
|
|
#include "sched.h"
|
|
|
|
#ifdef CONFIG_SMP
|
|
static int
|
|
select_task_rq_stop(struct task_struct *p, int cpu, int sd_flag, int flags)
|
|
{
|
|
return task_cpu(p); /* stop tasks as never migrate */
|
|
}
|
|
#endif /* CONFIG_SMP */
|
|
|
|
static void
|
|
check_preempt_curr_stop(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
/* we're never preempted */
|
|
}
|
|
|
|
static void set_next_task_stop(struct rq *rq, struct task_struct *stop)
|
|
{
|
|
stop->se.exec_start = rq_clock_task(rq);
|
|
}
|
|
|
|
static struct task_struct *
|
|
pick_next_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
|
|
{
|
|
struct task_struct *stop = rq->stop;
|
|
|
|
if (!stop || !task_on_rq_queued(stop))
|
|
return NULL;
|
|
|
|
put_prev_task(rq, prev);
|
|
set_next_task_stop(rq, stop);
|
|
|
|
return stop;
|
|
}
|
|
|
|
static void
|
|
enqueue_task_stop(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
add_nr_running(rq, 1);
|
|
}
|
|
|
|
static void
|
|
dequeue_task_stop(struct rq *rq, struct task_struct *p, int flags)
|
|
{
|
|
sub_nr_running(rq, 1);
|
|
}
|
|
|
|
static void yield_task_stop(struct rq *rq)
|
|
{
|
|
BUG(); /* the stop task should never yield, its pointless. */
|
|
}
|
|
|
|
static void put_prev_task_stop(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
|
|
{
|
|
struct task_struct *curr = rq->curr;
|
|
u64 delta_exec;
|
|
|
|
delta_exec = rq_clock_task(rq) - curr->se.exec_start;
|
|
if (unlikely((s64)delta_exec < 0))
|
|
delta_exec = 0;
|
|
|
|
schedstat_set(curr->se.statistics.exec_max,
|
|
max(curr->se.statistics.exec_max, delta_exec));
|
|
|
|
curr->se.sum_exec_runtime += delta_exec;
|
|
account_group_exec_runtime(curr, delta_exec);
|
|
|
|
curr->se.exec_start = rq_clock_task(rq);
|
|
cgroup_account_cputime(curr, delta_exec);
|
|
}
|
|
|
|
/*
|
|
* scheduler tick hitting a task of our scheduling class.
|
|
*
|
|
* NOTE: This function can be called remotely by the tick offload that
|
|
* goes along full dynticks. Therefore no local assumption can be made
|
|
* and everything must be accessed through the @rq and @curr passed in
|
|
* parameters.
|
|
*/
|
|
static void task_tick_stop(struct rq *rq, struct task_struct *curr, int queued)
|
|
{
|
|
}
|
|
|
|
static void switched_to_stop(struct rq *rq, struct task_struct *p)
|
|
{
|
|
BUG(); /* its impossible to change to this class */
|
|
}
|
|
|
|
static void
|
|
prio_changed_stop(struct rq *rq, struct task_struct *p, int oldprio)
|
|
{
|
|
BUG(); /* how!?, what priority? */
|
|
}
|
|
|
|
static unsigned int
|
|
get_rr_interval_stop(struct rq *rq, struct task_struct *task)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static void update_curr_stop(struct rq *rq)
|
|
{
|
|
}
|
|
|
|
/*
|
|
* Simple, special scheduling class for the per-CPU stop tasks:
|
|
*/
|
|
const struct sched_class stop_sched_class = {
|
|
.next = &dl_sched_class,
|
|
|
|
.enqueue_task = enqueue_task_stop,
|
|
.dequeue_task = dequeue_task_stop,
|
|
.yield_task = yield_task_stop,
|
|
|
|
.check_preempt_curr = check_preempt_curr_stop,
|
|
|
|
.pick_next_task = pick_next_task_stop,
|
|
.put_prev_task = put_prev_task_stop,
|
|
.set_next_task = set_next_task_stop,
|
|
|
|
#ifdef CONFIG_SMP
|
|
.select_task_rq = select_task_rq_stop,
|
|
.set_cpus_allowed = set_cpus_allowed_common,
|
|
#endif
|
|
|
|
.task_tick = task_tick_stop,
|
|
|
|
.get_rr_interval = get_rr_interval_stop,
|
|
|
|
.prio_changed = prio_changed_stop,
|
|
.switched_to = switched_to_stop,
|
|
.update_curr = update_curr_stop,
|
|
};
|