Repository navigation
Conversation
…th-tsrm-tls-model=initial-exec to explicitly override it
|
Apparently there is only one I agree that we could add the |
|
Yes, good idea. Since zend already includes tsrm, we could just change the ZEND_TLS definition on master. |
ndossche
left a comment
There was a problem hiding this comment.
All the threading complications are not nice of course, but it is what it is.
Thanks for tackling this.
|
Hold on before merging this, I just stumbled across I think instead of forcing global-dynamic or adding our own option, we can instead default to no tls model and advise to add It results in the same effect, no tls model specified means global-dynamic for shared libraries, but we wouldn't need a |
henderkes
left a comment
There was a problem hiding this comment.
Back to draft because I don't want to push to an approved PR.
What do you think? Go with the explicit configure option, or advise to overwrite the default with -ftls-model?
| # if defined(TSRM_TLS_MODEL_USE_DEFAULT) | ||
| # define TSRM_TLS_MODEL_ATTR | ||
| # define TSRM_TLS_MODEL_DEFAULT |
There was a problem hiding this comment.
This is still an extra block under PIC && !PIE instead of adding it above, because we want to keep the explicit local-exec choice in !PIC || PIE.
arnaud-lb
left a comment
There was a problem hiding this comment.
The new version is better 👍
ndossche
left a comment
There was a problem hiding this comment.
I have concerns:
- Now a slower TLS model will likely be used. This raises the question whether it was worth moving AG & SCNG into the TLS section, which seems to have caused this in the first place.
- With -ftls-model=initial-exec in CFLAGS, TSRM_TLS_MODEL_USE_DEFAULT is still defined. This mean, tsrm_get_ls_cache_tcb_offset() going to return 0 and not use the fast path. This is not desirable.
Another 256 bytes came from ext-uri (added in 8.6). They don't need fast tls access, but like Arnaud explained still count towards the budget. So we'll either need to refactor that, and a bunch of other tls variables, or go the only route that is safe for dlopen()ed libraries - which is this.
Ah yeah, Apache would get the slow jit. Let me fix that. |
|
Opened the other approach in a draft PR, but like I said there, definitely favour this approach. For one it leaves the path open to using more thread storage directly in the future, which will directly benefit performance, without worrying about static TLS. It also benefits musl and other OSes that don't have a static TLS surplus. Perhaps we can even do away with the whole macro block in tsrm.h and just set the right model directly via build system (linked against = initial-exec, not linked against = global-dynamic). |
... use
--with-tsrm-tls-model=initial-execto explicitly override itcloses #24262
split off from #23227
@ndossche @arnaud-lb
Are there any plans to make pcre or ext-URI buildable as shared modules? If not, we should probably add TSRM_TLS_MODEL attribute to their __thread variables too. They currently get no model and the slow access sequence, but still count towards the static tls surplus budget - it's really weird.