Re: powertop "pread cpu0 0xe8 : Bad file descriptor" fixed by CONFIG_MSR

From: AmÃrico Wang
Date: Mon Aug 08 2011 - 05:08:13 EST


On Sun, Aug 7, 2011 at 6:52 AM, Andy Isaacson <adi@xxxxxxxxxxxxx> wrote:
> I hadn't seen this issue discussed on the list, and I don't know of a
> powertop mailing list, so here's what stymied my use of powertop until I
> straced it.
>
> With CONFIG_MSR=n, powertop "1.97-2" (from Debian unstable) on 3.0.1
> (and presumably many other recent kernels) exits at startup with:
>
> pread cpu0 0xe8 : Bad file descriptor
>
> strace shows:
>
> open("/dev/cpu/0/msr", O_RDONLY) = -1 ENOENT (No such file or directory)
> pread(4294967295, 0x7fff4c8347c8, 8, 232) = -1 EBADF (Bad file descriptor)
>

Seems powertop forgot to check the return value of that open().
This is a bug of powertop, not kernel.
--
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/