Re: [RESEND][RFC] lscpu - CPU architecture information helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Jul 9, 2008 at 05:50, Cai Qian <qcai@xxxxxxxxxx> wrote:
> From: "Bert Wesarg" <bert.wesarg@xxxxxxxxxxxxxx>
> Subject: Re: [RESEND][RFC] lscpu - CPU architecture information helper
> Date: Tue, 8 Jul 2008 18:04:21 +0200
>
>> > /* Convert hexdecimal number from a mapping file to decimal.*/
>> > double
>> > decimal (char *file)
>> So you extend your supported number of cpus from 32 to 52, great. You
>> should either look inside the kernel code, kernel documentationm or
>> into the libbitmask(3) from Paul Jackson/SGI [1].
>>
>
> Hmm, it has been tested successfully on a 64 CPUs SGI machine though,
but sibling(decimal(<file with "0xffffffffffffffff" as content>)) is 1
not 64. But you can easily solve this, because you only use this
pattern 'sibling (decimal (<file>))' and effectively count only the
set bits:

/* count the set bit in a cpumap file */
int
sibling (char *file)
{
  int c;
  int result = 0;
  File *fp;

  fp = fopen (file, "r");
  if (fp == NULL)
    err (1, "fopen %s", file);

  while ((c = fgetc (fp)) != EOF)
    {
      if (isxdigit (c))
        result += <number of bits in char 'c'>;
    }

  fclose (fp);

  return result;
}

and than replace all 'sibling (decimal (buf))' with 'sibling (buf)'

>> Again, no support for holes in the cpu range. But I'm currently unsure
>> if holes are actually possible. What about using readdir and check for
>> a cpu%d pattern of the dir name with sscanf?
>>
>
> There should not be a hole. Otherwise, a Kernel bug? I have tried to
> offline a CPU, but it does still has a entry there.
That should be true. I have dealt mostly with online cpus only, but
this doesn't fit here.

>> What about nodes >0, in node0/cpumap are only the cpus from node0, you
>> should also check the cpumaps from the other nodes.
>>
>
> So there is a possibility that different nodes have different number of
> CPUs? If so, that looks like too complicated to handle in this program,
> and I'll probably remove NUMA information at all.
Sure, just remove one cpu from a node.

Bert
>
> CaiQian
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux