This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use __syscall_ulong_t for __cpu_mask


On Tue, Dec 1, 2015 at 10:17 AM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 12/01/2015 12:07 PM, H.J. Lu wrote:
>>>> >> What exactly was the failure mode you saw in bug 19313?
>>>> >>
>>> >
>>> > I got
>>> >
>>> > FAIL: nptl/tst-thread-affinity-pthread
>>> > FAIL: nptl/tst-thread-affinity-pthread2
>>> > FAIL: nptl/tst-thread-affinity-sched
>>> > FAIL: posix/tst-affinity
>>> > FAIL: posix/tst-affinity-pid
>>> >
>>> > since size 12, which isn't multiple of 8, is passed to sched_getaffinity
>>> > syscall. We got 12 since __cpu_mask is unsigned long, instead of
>>> > unsigned long long.
>
> Thanks, that explains it all. Was it really 12 or 4? I expect it was 4
> on x32 and that fails because the affinity mask wants a minimum size of 8
> on x86_64.

It came from

  size_t kernel_size = CPU_ALLOC_SIZE (size);

  if (getaffinity (kernel_size, initial_set) < 0)
    {
      printf ("error: size %zu: getaffinity: %m\n", size);
      return false;
    }

and

# define __CPU_ALLOC_SIZE(count) \
  ((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask))

When size == 96, x32 got 12, instead of 16.

>> Here is a patch to add __CPU_MASK_TYPE for __cpu_mask.
>> Tested on x32, i686 and x86-64.  OK for master?
>
> Looks good to me. This is a bit safer and I like the explicit macro
> which makes it easy to identify what is or is not a CPU mask.
>
> Don't forget to mark the fixed bug with target milestone 2.23 per the
> new bugzilla rules to auto-generate NEWS.

Will do.

Thanks.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]