Re: [PATCH v2] sched: Fix print format for u64

From: Paul Turner
Date: Fri Jan 25 2013 - 02:31:27 EST


On Thu, Jan 24, 2013 at 11:19 PM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> * Fabio Estevam <festevam@xxxxxxxxx> wrote:
>
>> On Thu, Jan 24, 2013 at 12:19 PM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>>
>> > I suppose - is this patch warning-free both on 64-bit and 32-bit
>> > systems?
>>
>> Yes, just confirmed that this patch is warning-free on both 64-bit and
>> 32-bit machines.
>
> Apparently it's not all good, see the warning attached below.

Yeah this patch is broken; this is not properly fixable as is without
#ifdefs (or fixing the insanity that is atomic64_read).

Specifically:

On some architectures (e.g. x86_64) atomic64_read is typed long
On some others (e.g. x86-32) it's typed long long
On yet others (e.g. arm) it's typed u64

I think the easiest way to fix it would be instead to promote the read
into a local u64 and print that.

>
> Thanks,
>
> Ingo
>
> ----- Forwarded message from kbuild test robot <fengguang.wu@xxxxxxxxx> -----
>
> Date: Fri, 25 Jan 2013 14:02:05 +0800
> From: kbuild test robot <fengguang.wu@xxxxxxxxx>
> To: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Subject: [next:akpm 188/817] kernel/sched/debug.c:225:2: warning: format '%llu' expects argument
> of type 'long long unsigned int', but argument 4 has type 'long int'
>
> tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm
> head: 5d2ee7d8b03bfe3b90325d736d8e544d0394efa7
> commit: 2d58000fd2020255af63ee92c8d0ef615f6c4ade [188/817] sched: Fix print format for u64
> config: make ARCH=x86_64 allmodconfig
>
> All warnings:
>
> kernel/sched/debug.c: In function 'print_cfs_rq':
>>> kernel/sched/debug.c:225:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'long int' [-Wformat]
>>> kernel/sched/debug.c:225:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'long int' [-Wformat]
>
> vim +225 kernel/sched/debug.c
>
> 209 spread = max_vruntime - MIN_vruntime;
> 210 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread",
> 211 SPLIT_NS(spread));
> 212 spread0 = min_vruntime - rq0_min_vruntime;
> 213 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "spread0",
> 214 SPLIT_NS(spread0));
> 215 SEQ_printf(m, " .%-30s: %d\n", "nr_spread_over",
> 216 cfs_rq->nr_spread_over);
> 217 SEQ_printf(m, " .%-30s: %d\n", "nr_running", cfs_rq->nr_running);
> 218 SEQ_printf(m, " .%-30s: %ld\n", "load", cfs_rq->load.weight);
> 219 #ifdef CONFIG_FAIR_GROUP_SCHED
> 220 #ifdef CONFIG_SMP
> 221 SEQ_printf(m, " .%-30s: %lld\n", "runnable_load_avg",
> 222 cfs_rq->runnable_load_avg);
> 223 SEQ_printf(m, " .%-30s: %lld\n", "blocked_load_avg",
> 224 cfs_rq->blocked_load_avg);
> > 225 SEQ_printf(m, " .%-30s: %llu\n", "tg_load_avg",
> 226 atomic64_read(&cfs_rq->tg->load_avg));
> 227 SEQ_printf(m, " .%-30s: %lld\n", "tg_load_contrib",
> 228 cfs_rq->tg_load_contrib);
> 229 SEQ_printf(m, " .%-30s: %d\n", "tg_runnable_contrib",
> 230 cfs_rq->tg_runnable_contrib);
> 231 SEQ_printf(m, " .%-30s: %d\n", "tg->runnable_avg",
> 232 atomic_read(&cfs_rq->tg->runnable_avg));
> 233 #endif
>
> ---
> 0-DAY kernel build testing backend Open Source Technology Center
> http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
>
> ----- End forwarded message -----
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/