Skip to contentSkip to conversation

tools/libs/store: add missing USE_PTHREAD to target .o

PATCH In review Andrei Stan 4 participants 7 messages Jul 5, 2024 – Sep 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libs/store: add missing USE_PTHREAD to target .o

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Backport: 4.18+ # maybe older

---
 tools/libs/store/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/libs/store/Makefile +1 -0
index 0649cf8307..c6f147c72f 100644
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxentoolcore)
 
 xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
 ifeq ($(CONFIG_Linux),y)
 xs.opic: CFLAGS += -DUSE_DLSYM
 endif
Signature · 1 line
2.43.0
#1 lore raw
Quoted 15 lines · Andrei Stan

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Backport: 4.18+ # maybe older

---
 tools/libs/store/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/libs/store/Makefile +0 -0
index 0649cf8307..c6f147c72f 100644

tools/libs/store/Makefile CFLAGS += -include $(XEN_ROOT)/tools/config.h · line 26

Quoted 7 lines
tools/libs/store/Makefile +1 -0
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxentoolcore)
 
 xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
 ifeq ($(CONFIG_Linux),y)
 xs.opic: CFLAGS += -DUSE_DLSYM
 endif

Funnily enough, I did wonder whether that mattered recently.  I guess it does.

CC Oleksii for a view to 4.19.

Also, we should transform the Backport: tag into a Fixes: tag if there's a suitable one to pick.

~Andrew

#2 lore raw
In reply to Andrei Stan
Quoted 6 lines · Andrei Stan

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Backport: 4.18+ # maybe older

Commit dde3e02b7068 did that explicitly, stating that phtreads are not compatible with static linking.

Was that reasoning wrong?

Juergen

Quoted 16 lines
---
  tools/libs/store/Makefile | 1 +
  1 file changed, 1 insertion(+)
tools/libs/store/Makefile +1 -0
index 0649cf8307..c6f147c72f 100644
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
  CFLAGS += $(CFLAGS_libxentoolcore)
 
  xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
  ifeq ($(CONFIG_Linux),y)
  xs.opic: CFLAGS += -DUSE_DLSYM
  endif
#3 lore raw
Quoted 27 lines · Jürgen Groß
Quoted 6 lines · Andrei Stan

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Backport: 4.18+ # maybe older

Commit dde3e02b7068 did that explicitly, stating that phtreads are not compatible with static linking.

Was that reasoning wrong?

Juergen
---

Quoted 11 lines
---
  tools/libs/store/Makefile | 1 +
  1 file changed, 1 insertion(+)
tools/libs/store/Makefile +0 -0
index 0649cf8307..c6f147c72f 100644
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
  CFLAGS += $(CFLAGS_libxentoolcore)
 
Quoted 5 lines

tools/libs/store/Makefile CFLAGS += -include $(XEN_ROOT)/tools/config.h · line 26

Quoted 5 lines
tools/libs/store/Makefile +1 -0
  xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
  ifeq ($(CONFIG_Linux),y)
  xs.opic: CFLAGS += -DUSE_DLSYM
  endif

It was a pretty nasty situation, giving some context, this is for a Go based CLI tool and some things in there are multithreaded, but i don't think calling in the
bindings happens anywhere in parallel. Without this patch there would be some sort of race conditions (or so I assume from the debugging i've done) happening withing the xen/tools code, making it impossible to start a domain.

In this case there were no issues in linking pthreads statically. I was not even aware of that being a possible issue. Is it really?

Also I am not too sure how much that code path is actually tested, probably the majority of the testing is done with dynamic builds.

Andrei

#4 lore raw

Ping

Quoted 49 lines · Andrei Stan
Quoted 27 lines · Jürgen Groß
Quoted 6 lines · Andrei Stan

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Backport: 4.18+ # maybe older

Commit dde3e02b7068 did that explicitly, stating that phtreads are not compatible with static linking.

Was that reasoning wrong?

Juergen
---

Quoted 11 lines
---
  tools/libs/store/Makefile | 1 +
  1 file changed, 1 insertion(+)
tools/libs/store/Makefile +0 -0
index 0649cf8307..c6f147c72f 100644
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
  CFLAGS += $(CFLAGS_libxentoolcore)
 
Quoted 5 lines

tools/libs/store/Makefile CFLAGS += -include $(XEN_ROOT)/tools/config.h · line 26

Quoted 5 lines
tools/libs/store/Makefile +1 -0
  xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
  ifeq ($(CONFIG_Linux),y)
  xs.opic: CFLAGS += -DUSE_DLSYM
  endif

It was a pretty nasty situation, giving some context, this is for a Go based CLI tool and some things in there are multithreaded, but i don't think calling in the
bindings happens anywhere in parallel. Without this patch there would be some sort of race conditions (or so I assume from the debugging i've done) happening withing the xen/tools code, making it impossible to start a domain.

In this case there were no issues in linking pthreads statically. I was not even aware of that being a possible issue. Is it really?

Also I am not too sure how much that code path is actually tested, probably the majority of the testing is done with dynamic builds.

Andrei

#5 lore raw
Quoted 1 line · Andrei Stan

Ping

This is pinging what exactly? From ...

Quoted 9 lines · Andrei Stan
Quoted 8 lines · Jürgen Groß
Quoted 6 lines · Andrei Stan
Quoted 4 lines

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

Backport: 4.18+ # maybe older

Commit dde3e02b7068 did that explicitly, stating that phtreads are not compatible with static linking.

Was that reasoning wrong?

... Jürgen's question it imo follows that ...

Quoted 24 lines
Quoted 24 lines
Quoted 11 lines
Quoted 11 lines
---
  tools/libs/store/Makefile | 1 +
  1 file changed, 1 insertion(+)
tools/libs/store/Makefile +0 -0
index 0649cf8307..c6f147c72f 100644
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
  CFLAGS += $(CFLAGS_libxentoolcore)
 
Quoted 5 lines

tools/libs/store/Makefile CFLAGS += -include $(XEN_ROOT)/tools/config.h · line 26

Quoted 5 lines
tools/libs/store/Makefile +1 -0
  xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
  ifeq ($(CONFIG_Linux),y)
  xs.opic: CFLAGS += -DUSE_DLSYM
  endif

It was a pretty nasty situation, giving some context, this is for a Go based CLI tool and some things in there are multithreaded, but i don't think calling in the
bindings happens anywhere in parallel. Without this patch there would be some sort of race conditions (or so I assume from the debugging i've done) happening withing the xen/tools code, making it impossible to start a domain.

Quoted 5 lines
Quoted 5 lines

In this case there were no issues in linking pthreads statically. I was not even aware of that being a possible issue. Is it really?

Also I am not too sure how much that code path is actually tested, probably the majority of the testing is done with dynamic builds.

... this answer is insufficient, from two angles:
- You do in no way answer the question itself, as such an answer would clearly need to say something about the commit Jürgen pointed you at.
- It needs to be in the patch description, not just in a reply on list. IOW a re-submission is needed anyway.

Jan

#6 lore raw
In reply to Andrei Stan
Quoted 41 lines · Andrei Stan
Quoted 27 lines · Jürgen Groß
Quoted 6 lines · Andrei Stan

Currently only shared libraries build with USE_PTHREAD enabled.

This patch adds the macro also to xs.o.

Backport: 4.18+ # maybe older

Commit dde3e02b7068 did that explicitly, stating that phtreads are not compatible with static linking.

Was that reasoning wrong?

Juergen
---

Quoted 11 lines
---
   tools/libs/store/Makefile | 1 +
   1 file changed, 1 insertion(+)
tools/libs/store/Makefile +0 -0
index 0649cf8307..c6f147c72f 100644
@@ -20,6 +20,7 @@ CFLAGS += -include $(XEN_ROOT)/tools/config.h
   CFLAGS += $(CFLAGS_libxentoolcore)
 
Quoted 5 lines

tools/libs/store/Makefile CFLAGS += -include $(XEN_ROOT)/tools/config.h · line 26

Quoted 5 lines
tools/libs/store/Makefile +1 -0
   xs.opic: CFLAGS += -DUSE_PTHREAD
+xs.o: CFLAGS += -DUSE_PTHREAD
   ifeq ($(CONFIG_Linux),y)
   xs.opic: CFLAGS += -DUSE_DLSYM
   endif

It was a pretty nasty situation, giving some context, this is for a Go based CLI tool and some things in there are multithreaded, but i don't think calling in the
bindings happens anywhere in parallel. Without this patch there would be some sort of race conditions (or so I assume from the debugging i've done) happening withing the xen/tools code, making it impossible to start a domain.

Quoted 2 lines

In this case there were no issues in linking pthreads statically. I was not even aware of that being a possible issue. Is it really?

I don't know. Said commit suggests it at least was an issue in the past. No idea what was wrong with it and whether the situation has changed since then.

Another question: why are you linking statically? Dynamic linking seems to be the standard for Go.

Quoted 2 lines

Also I am not too sure how much that code path is actually tested, probably the majority of the testing is done with dynamic builds.

I think so, yes. I'm not aware of any tests using static libraries.

Juergen