[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190211135159.GC32511@hirez.programming.kicks-ass.net>
Date: Mon, 11 Feb 2019 14:51:59 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Julien Thierry <julien.thierry@....com>,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
mingo@...hat.com, catalin.marinas@....com, will.deacon@....com,
james.morse@....com, hpa@...or.com, valentin.schneider@....com
Subject: Re: [PATCH v3 3/4] uaccess: Check no rescheduling function is called
in unsafe region
On Mon, Feb 11, 2019 at 02:45:27PM +0100, Ingo Molnar wrote:
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index a674c7db..b1bb7e9 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -3289,6 +3289,14 @@ static inline void schedule_debug(struct task_struct *prev)
> > __schedule_bug(prev);
> > preempt_count_set(PREEMPT_DISABLED);
> > }
> > +
> > + if (IS_ENABLED(CONFIG_DEBUG_UACCESS_SLEEP) &&
> > + unlikely(unsafe_user_region_active())) {
> > + printk(KERN_ERR "BUG: scheduling while user_access enabled: %s/%d/0x%08x\n",
> > + prev->comm, prev->pid, preempt_count());
> > + dump_stack();
> > + }
> > +
> > rcu_sleep_check();
> >
> > profile_hit(SCHED_PROFILING, __builtin_return_address(0));
> > @@ -6151,6 +6159,20 @@ void ___might_sleep(const char *file, int line, int preempt_offset)
> > EXPORT_SYMBOL(___might_sleep);
> > #endif
> >
> > +#ifdef CONFIG_DEBUG_UACCESS_SLEEP
> > +void __might_resched(const char *file, int line)
> > +{
> > + if (!unsafe_user_region_active())
> > + return;
>
> Could you please more clearly explain why you want/need an exception from
> the __might_resched() debug warning?
In specific; how is the addition in schedule_debug() not triggering on
PREEMPT=y kernels?
If code is preemptible, you can (get) schedule(d). If it is not
preemptible; you do not need these additional tests.
Powered by blists - more mailing lists