|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] tools/xenstore: try to get minimum thread stack size for watch thread
On 22/02/18 19:55, Wei Liu wrote:
> On Thu, Feb 22, 2018 at 06:53:28PM +0000, Wei Liu wrote:
>> On Thu, Feb 22, 2018 at 07:44:22PM +0100, Juergen Gross wrote:
>>> On 22/02/18 18:28, Wei Liu wrote:
>>>> On Thu, Feb 22, 2018 at 02:53:35PM +0100, Juergen Gross wrote:
>>>>> When creating a pthread in xs_watch() try to get the minimal needed
>>>>> size of the thread from glibc instead of using a constant. This avoids
>>>>> problems when the library is used in programs with large per-thread
>>>>> memory.
>>>>>
>>>>> Use dlsym() to get the pointer to __pthread_get_minstack() in order to
>>>>> avoid linkage problems and fall back to the current constant size if
>>>>> not found.
>>>>>
>>>>> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
>>>>> ---
>>>>> Only compile tested. Jim, can you please verify this patch is solving
>>>>> your original problem?
>>>>> ---
>>>>> tools/xenstore/Makefile | 4 ++++
>>>>> tools/xenstore/xs.c | 19 ++++++++++++++++++-
>>>>> 2 files changed, 22 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile
>>>>> index 2b99d2bc1b..fb6c73e297 100644
>>>>> --- a/tools/xenstore/Makefile
>>>>> +++ b/tools/xenstore/Makefile
>>>>> @@ -100,6 +100,10 @@ libxenstore.so.$(MAJOR):
>>>>> libxenstore.so.$(MAJOR).$(MINOR)
>>>>> ln -sf $< $@
>>>>>
>>>>> xs.opic: CFLAGS += -DUSE_PTHREAD
>>>>> +ifeq ($(CONFIG_Linux),y)
>>>>> +xs.opic: CFLAGS += -DUSE_DLSYM
>>>>> +xs.opic: LDFLAGS += -ldl
>>>>> +endif
>>>>>
>>>>> libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
>>>>> $(CC) $(LDFLAGS) $(PTHREAD_LDFLAGS) -Wl,$(SONAME_LDFLAG)
>>>>> -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
>>>>> $(LDLIBS_libxentoolcore) $(SOCKET_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
>>>>> diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c
>>>>> index abffd9cd80..8372f5b1a4 100644
>>>>> --- a/tools/xenstore/xs.c
>>>>> +++ b/tools/xenstore/xs.c
>>>>> @@ -47,6 +47,11 @@ struct xs_stored_msg {
>>>>>
>>>>> #include <pthread.h>
>>>>>
>>>>> +#ifdef USE_DLSYM
>>>>> +#define __USE_GNU
>>>>
>>>> Where does this come from? DLSYM(3) says _GNU_SOURCE (which we already
>>>> have).
>>>
>>> On my machine build failed, so I looked into the header...
>>>
>>
>> Does putting _GNU_SOURCE at the beginning of that file before all
>> headers solve the issue? I don't think we want to use an internal
>> definition.
Aah, I put it just before including dlfcn.h and it didn't work. Putting
it at the beginning solves the problem.
I'll send V2 after waiting a bit for other comments.
> And I was wrong about "we already have _GNU_SOURCE" bit in my previous
> email. At least not in the file you modified.
Xenstore uses it already, too.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |