[SPAM]Re: [Bug] Race condition between CPU hotplug off flow and __sched_setscheduler()

Jing-Ting Wu jing-ting.wu at mediatek.com
Wed May 25 22:57:55 PDT 2022


Hi Peter


> > How easy can you reproduce; does the below hack make it better?
> 
> 
> The issue can be reproduced in about 48 hours when hotplug up/down
> frequently.
> 
> Thanks for your suggestion.
> I think the hack patch could stay the rq->balance_callback when rq-
> > callback = &balance_push_callback.
> 
> We can add hack patch to the stability test.

Use the patch of previous mail, we pass the stability test at previous
48 hours and still testing.

I think the patch could make the issue better.
Do you suggest to upstream this patch to mainline?

Thank you.

> > 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 95bac3b094b3..f18ee22b29bc 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -4763,20 +4763,30 @@ struct callback_head balance_push_callback
> > =
> > {
> >  	.func = (void (*)(struct callback_head *))balance_push,
> >  };
> >  
> > -static inline struct callback_head
> > *splice_balance_callbacks(struct
> > rq *rq)
> > +static inline struct callback_head *
> > +__splice_balance_callbacks(struct rq *rq, bool foo)
> >  {
> >  	struct callback_head *head = rq->balance_callback;
> >  
> >  	lockdep_assert_rq_held(rq);
> > -	if (head)
> > -		rq->balance_callback = NULL;
> > +	if (head) {
> > +		if (foo && head == &balance_push_callback)
> > +			head = NULL;
> > +		else
> > +			rq->balance_callback = NULL;
> > +	}
> >  
> >  	return head;
> >  }
> >  
> > +static inline struct callback_head
> > *splice_balance_callbacks(struct
> > rq *rq)
> > +{
> > +	return __splice_balance_callbacks(rq, true);
> > +}
> > +
> >  static void __balance_callbacks(struct rq *rq)
> >  {
> > -	do_balance_callbacks(rq, splice_balance_callbacks(rq));
> > +	do_balance_callbacks(rq, __splice_balance_callbacks(rq,
> > false));
> >  }
> >  
> >  static inline void balance_callbacks(struct rq *rq, struct
> > callback_head *head)
> > 
> 

Best Regards,
Jing-Ting Wu






More information about the Linux-mediatek mailing list