Newsgroups: php.cvs,php.internals Path: news.php.net Xref: news.php.net php.cvs:81982 php.internals:77686 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39651 invoked from network); 26 Sep 2014 21:00:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2014 21:00:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:49802] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/46-02658-5D3D5245 for ; Fri, 26 Sep 2014 17:00:08 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 33) id D40726D209D; Fri, 26 Sep 2014 22:59:58 +0200 (CEST) Received: from 79.197.76.249 (SquirrelMail authenticated user anatol@belski.net) by webmail.klapt.com with HTTP; Fri, 26 Sep 2014 22:59:58 +0200 Message-ID: <57df99a6abdfeeb9036b529fb83175bd.squirrel@webmail.klapt.com> In-Reply-To: References: <35865ab5a49aa7711727174e173d0723.squirrel@webmail.klapt.com> Date: Fri, 26 Sep 2014 22:59:58 +0200 To: "Dmitry Stogov" Cc: "Anatol Belski" , "Joe Watkins" , "Anatol Belski" , "Nikita Popov" , php-cvs@lists.php.net, "PHP Internals" , "Pierre Joye" , "Nikita Popov" , "Xinchen Hui" User-Agent: SquirrelMail/1.5.2 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [PHP-CVS] com php-src: fix CG(empty_string) init in ZTS: Zend/zend.c From: anatol.php@belski.net ("Anatol Belski") Hi Dmitry, On Mon, September 22, 2014 08:43, Dmitry Stogov wrote: > Hi Anatol, > > > I didn't completely get your ideas, but if tsrm_ls_cache can't be > exported on Windows directly, can we have a copy of tsrm_ls_cache in each > DLL/EXE > and initialize it once? > > Thanks. Dmitry. > Joe and me was working on this and there is a worky version now. Generally it suffers from some issues already present in master, but in all things together it's a worky crossplatform approach. Please look up the native-tls branch. For the current variant I used the idea from the original RFC, but removed exporting the TSRM cache through a __thread variable as it's not portable. I've also removed the offset logic from the RFC patch, as that brought additional hard to find bugs especially into the current unstable version. I don't think it's necessary to copy the arbitrary globals structs in every ext, further more i think it's not easy possible without some big overhead. However even with the current native-tls branch I'm able to run wordpress, symfony, ab -c 8 -n 2048 pass also with multiple calls. Still, some Apache bugs are already reported against master, I also repro some others, mostly arbitrary shutdown crashes in Apache (so TS version). So as they're in master, they're for sure in native-tls. PHP happens to always have used TLS, however the pointer was passed directly to the functions. In TSRM.c, that's tsrm_tls_get/tsrm_tls_set. Now, a function wrapper is used to fetch the TLS cache directly in the TSRMG macro. This makes the whole slowlier, but allows to get rid of the TSRMLS_* macros. The big question is to optimize the function call to speedup the whole. Maybe one can speedup it saving a tsrm ls cache pointer locally per extension or code area. ATM we're checking the functional part, then one can proceed further with removing the TSRMLS_* macros. Any speedup or improvement thoughts are welcome. Possible directions of the further work after known bugs are fixed (in master or in native-tls), some are mutually exclusive - reimplement the offset logic instead of arrays for the globals structs - share the tsrm cache pointer globally to some scope, like extension or sapi - remove the linked lists logic and use TLS explicitly - improve locking Thanks Anatol