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: FOR REVIEW: New x86-64 vsyscall vgetcpu()


In principle this is a good development.  Ingo and I contemplated the
same for some time.  But there are issues which should be solved.

1.  x86-64 should be converted to the regular vDSO format we use for the
other archs.  These magic addresses are simply unacceptable.  Adding yet
another one makes things only worse.  Outside glibc nobody should use
them so it's just one dependency.  We can control via setarch whether
the old code is available for an interim period.

> long vgetcpu(int *cpu, int *node, unsigned long *tcache)

Do you expect the value returned in *cpu and*node to require an error
value?  If not, then why this fascination with signed types?

And as for the cache: you definitely should use a length parameter.
We've seen in the past over and over again that implicit length
requirements sooner or later fail.

Maybe this is a more commonly needed requirement for the vdso in
feature.  In which case it might be adequate to have a new vdso
functions which returns to total number of bytes needed for caches etc.
 This could be called while setting up the thread stack.  Then we pass a
pointer to an approriately sized local memory region to this call and
others.  The vdso functions will organize among themselves which part of
the buffer each of them can use.  Internally it would be a struct,
initially with only the two longs you currently have in mind.

Not doing it this way would mean that for each new vdso function needing
 TLS memory we would have to modify the very lowlevel TLS structures.
That's a horrible proposition.


So, I suggest adding

long vgettlsreq(void);


which would be implemented using something like this


struct vdso_tls {
  unsigned long getcpu_cache[2];
};

long vgettlsreq(void) { return sizeof (struct vdso_tls); }


and the beginning of vgetcpu would look like this


long vgetcpu(int *cpu, int *node, void *tlsptr) {
  unsigned long *tcache = &((struct vdso_tls *) tlsptr)->getcpu_cache;
  ...
}

-- 
â Ulrich Drepper â Red Hat, Inc. â 444 Castro St â Mountain View, CA â

Attachment: signature.asc
Description: OpenPGP digital signature


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