* [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments
@ 2013-08-30 17:31 Anatol Pomozov
[not found] ` <1377883916-8957-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Anatol Pomozov @ 2013-08-30 17:31 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, Anatol Pomozov
'samples' is 64bit operant, but do_div() second parameter is 32.
do_div silently truncates high 32 bits and calculated result
is invalid.
In case if low 32bit of 'samples' are zeros then do_div() produces
kernel crash.
Signed-off-by: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
block/cfq-iosched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index d5bbdcf..10fb653 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
if (samples) {
v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
- do_div(v, samples);
+ div64_u64(v, samples);
}
__blkg_prfill_u64(sf, pd, v);
return 0;
--
1.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments
[not found] ` <1377883916-8957-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-08-30 17:52 ` Anatol Pomozov
[not found] ` <1377885149-28208-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Anatol Pomozov @ 2013-08-30 17:52 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, Anatol Pomozov
'samples' is 64bit operant, but do_div() second parameter is 32.
do_div silently truncates high 32 bits and calculated result
is invalid.
In case if low 32bit of 'samples' are zeros then do_div() produces
kernel crash.
Signed-off-by: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
block/cfq-iosched.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index d5bbdcf..c410752 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
if (samples) {
v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
- do_div(v, samples);
+ v = div64_u64(v, samples);
}
__blkg_prfill_u64(sf, pd, v);
return 0;
--
1.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments
[not found] ` <1377885149-28208-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-09-13 16:20 ` Anatol Pomozov
[not found] ` <CAOMFOmV-MxF5vQqL1y4yY45LebFXA2DP7fsJx5CZcF+SSe6f7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Anatol Pomozov @ 2013-09-13 16:20 UTC (permalink / raw)
To: Tejun Heo; +Cc: Cgroups, Anatol Pomozov
Hi, Tejun
On Fri, Aug 30, 2013 at 10:52 AM, Anatol Pomozov
<anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 'samples' is 64bit operant, but do_div() second parameter is 32.
> do_div silently truncates high 32 bits and calculated result
> is invalid.
>
> In case if low 32bit of 'samples' are zeros then do_div() produces
> kernel crash.
>
> Signed-off-by: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> block/cfq-iosched.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index d5bbdcf..c410752 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
>
> if (samples) {
> v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
> - do_div(v, samples);
> + v = div64_u64(v, samples);
> }
> __blkg_prfill_u64(sf, pd, v);
> return 0;
what do you think about this patch?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments
[not found] ` <CAOMFOmV-MxF5vQqL1y4yY45LebFXA2DP7fsJx5CZcF+SSe6f7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-09-22 16:51 ` Tejun Heo
[not found] ` <20130922165122.GB30946-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2013-09-22 16:51 UTC (permalink / raw)
To: Anatol Pomozov; +Cc: Cgroups, Jens Axboe
(cc'ing Jens)
Hello,
On Fri, Sep 13, 2013 at 09:20:45AM -0700, Anatol Pomozov wrote:
> Hi, Tejun
>
> On Fri, Aug 30, 2013 at 10:52 AM, Anatol Pomozov
> <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 'samples' is 64bit operant, but do_div() second parameter is 32.
> > do_div silently truncates high 32 bits and calculated result
> > is invalid.
> >
> > In case if low 32bit of 'samples' are zeros then do_div() produces
> > kernel crash.
> >
> > Signed-off-by: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > ---
> > block/cfq-iosched.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> > index d5bbdcf..c410752 100644
> > --- a/block/cfq-iosched.c
> > +++ b/block/cfq-iosched.c
> > @@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
> >
> > if (samples) {
> > v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
> > - do_div(v, samples);
> > + v = div64_u64(v, samples);
> > }
> > __blkg_prfill_u64(sf, pd, v);
> > return 0;
>
> what do you think about this patch?
Sorry about the delay. Was traveling.
Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
blkcg patches are routed through Jens's block tree but I haven't been
able to get hold of Jens lately. Jens?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments
[not found] ` <20130922165122.GB30946-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
@ 2013-09-22 18:43 ` Jens Axboe
0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2013-09-22 18:43 UTC (permalink / raw)
To: Tejun Heo; +Cc: Anatol Pomozov, Cgroups
On Sun, Sep 22 2013, Tejun Heo wrote:
> (cc'ing Jens)
>
> Hello,
>
> On Fri, Sep 13, 2013 at 09:20:45AM -0700, Anatol Pomozov wrote:
> > Hi, Tejun
> >
> > On Fri, Aug 30, 2013 at 10:52 AM, Anatol Pomozov
> > <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > 'samples' is 64bit operant, but do_div() second parameter is 32.
> > > do_div silently truncates high 32 bits and calculated result
> > > is invalid.
> > >
> > > In case if low 32bit of 'samples' are zeros then do_div() produces
> > > kernel crash.
> > >
> > > Signed-off-by: Anatol Pomozov <anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > ---
> > > block/cfq-iosched.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> > > index d5bbdcf..c410752 100644
> > > --- a/block/cfq-iosched.c
> > > +++ b/block/cfq-iosched.c
> > > @@ -1803,7 +1803,7 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf,
> > >
> > > if (samples) {
> > > v = blkg_stat_read(&cfqg->stats.avg_queue_size_sum);
> > > - do_div(v, samples);
> > > + v = div64_u64(v, samples);
> > > }
> > > __blkg_prfill_u64(sf, pd, v);
> > > return 0;
> >
> > what do you think about this patch?
>
> Sorry about the delay. Was traveling.
>
> Acked-by: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>
> blkcg patches are routed through Jens's block tree but I haven't been
> able to get hold of Jens lately. Jens?
Sorry, been a bit crazy on my end. Will queue it up for 3.12, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-22 18:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-30 17:31 [PATCH] cfq: explicitly use 64bit divide operation for 64bit arguments Anatol Pomozov
[not found] ` <1377883916-8957-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-08-30 17:52 ` Anatol Pomozov
[not found] ` <1377885149-28208-1-git-send-email-anatol.pomozov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-13 16:20 ` Anatol Pomozov
[not found] ` <CAOMFOmV-MxF5vQqL1y4yY45LebFXA2DP7fsJx5CZcF+SSe6f7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-22 16:51 ` Tejun Heo
[not found] ` <20130922165122.GB30946-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-09-22 18:43 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.