Skip to contentSkip to conversation

sched: Fix signedness bug in yield_to()

DISCUSSION Shuah Khan 4 participants 8 messages Feb 21, 2013 – Feb 22, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Shuah Khan

author
#1 lore raw
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

Quoted 4 lines

bool __sched yield_to(struct task_struct *p, bool preempt) {

(quoted diff) +0 -0
@@ -4303,6 +4306,15 @@ bool __sched yield_to(struct task_struct *p, bool preempt)
 

Review bool __sched yield_to(struct task_struct *p, bool preempt) · line 4316

Quoted 10 lines
(quoted diff) +8 -0
 again:
 	p_rq = task_rq(p);
+	/*
+	 * If we're the only runnable task on the rq and target rq also
+	 * has only one task, there's absolutely no point in yielding.
+	 */
+	if (rq->nr_running == 1 && p_rq->nr_running == 1) {
+		yielded = -ESRCH;
+		goto out_irq;
+	}

Without the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task", do you need this change?

Am I missing something?

-- Shuah

#2 lore raw
Quoted 16 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Quoted 8 lines

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

Thanks,

Ingo

#3 lore raw
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

Quoted 6 lines
Quoted 2 lines

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

It is going via KVM tree. (as per Gleb's pull request)

author
#4 lore raw
Quoted 26 lines · Raghavendra KT
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

It is going via KVM tree. (as per Gleb's pull request)

Thanks. Do you see these two commits as stable release candidates?

-- Shuah

#5 lore raw
In reply to Ingo Molnar
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

Quoted 5 lines
Quoted 2 lines

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

commit c3c186403c6abd32e719f005f0af950155a9e54d

Author: Dan Carpenter <[email protected]>
Date:   Tue Feb 5 14:37:51 2013 +0300

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

#6 lore raw
Quoted 42 lines · Marcelo Tosatti
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

Quoted 5 lines
Quoted 2 lines

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

commit c3c186403c6abd32e719f005f0af950155a9e54d

Author: Dan Carpenter <[email protected]>
Date:   Tue Feb 5 14:37:51 2013 +0300

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Quoted 8 lines

IIUC, we are only changing variable in yield_to from bool to int. I am curious whether we need changes in struct sched_class (sched.h)

bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);
==>
int (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);

otherwise we would assign bool value to int here

yielded = curr->sched_class->yield_to_task(rq, p, preempt);

this return values also cascaded to kvm_main.c.

If we need to patchup entire thing, I can cook a correction patch.

Thanks and Regards
Raghu

author
#7 lore raw
Quoted 61 lines · Raghavendra KT
Quoted 42 lines · Marcelo Tosatti
Quoted 25 lines · Ingo Molnar
Quoted 22 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

Quoted 5 lines
Quoted 2 lines

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

commit c3c186403c6abd32e719f005f0af950155a9e54d

Author: Dan Carpenter <[email protected]>
Date:   Tue Feb 5 14:37:51 2013 +0300

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Quoted 8 lines

IIUC, we are only changing variable in yield_to from bool to int. I am curious whether we need changes in struct sched_class (sched.h)

bool (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);
==>
int (*yield_to_task) (struct rq *rq, struct task_struct *p, bool preempt);

otherwise we would assign bool value to int here

Quoted 8 lines

yielded = curr->sched_class->yield_to_task(rq, p, preempt);

this return values also cascaded to kvm_main.c.

If we need to patchup entire thing, I can cook a correction patch.

Thanks and Regards
Raghu

Right/. I was attempting to back-port c3c186403c6abd32e719f005f0af950155a9e54d to stables when I noticed the discrepancy. My concerns are:

1. Does it make sense to have c3c186403c6abd32e719f005f0af950155a9e54d in without 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" and?
2. Second concern is, is c3c186403c6abd32e719f005f0af950155a9e54d is enough or more changes are needed? does __yield_to prototype needs changes as well.

-- Shuah

-- Shuah

#8 lore raw
In reply to Marcelo Tosatti
Quoted 29 lines · Marcelo Tosatti
Quoted 28 lines · Ingo Molnar
Quoted 24 lines · Shuah Khan
Quoted 8 lines · Linux Kernel Mailing List
Gitweb:     http://git.kernel.org/linus/;a=commit;h=c3c186403c6abd32e719f005f0af950155a9e54d
Commit:     c3c186403c6abd32e719f005f0af950155a9e54d
Parent:     e0a79f529d5ba2507486d498b25da40911d95cf6
Author:     Dan Carpenter <[email protected]>
AuthorDate: Tue Feb 5 14:37:51 2013 +0300
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 5 12:59:29 2013 +0100
Quoted 5 lines

sched: Fix signedness bug in yield_to()

In 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" we changed this to store -ESRCH so it needs to be signed.

Dan, Ingo,

I can't find the 7b270f6099 "sched: Bail out of yield_to when source and target runqueue has one task" in the latest Linus's git. Am I missing something.

The current kenel/sched/core.c doesn't have the code from the associated patch https://patchwork.kernel.org/patch/2016651/

Quoted 8 lines
Quoted 2 lines

As per the lkml discussion that one was supposed to go upstream via the KVM tree. Marcelo?

commit c3c186403c6abd32e719f005f0af950155a9e54d

Author: Dan Carpenter <[email protected]>
Date:   Tue Feb 5 14:37:51 2013 +0300

sched: Fix signedness bug in yield_to()

I meant the other patch - the two got disassociated.

Thanks,

Ingo