Bug 202866 - Eliminate mach lookup to cfprefsd on process startup
Summary: Eliminate mach lookup to cfprefsd on process startup
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-10-11 14:37 PDT by Per Arne Vollan
Modified: 2019-11-05 16:32 PST (History)
6 users (show)

See Also:


Attachments
Patch (6.60 KB, patch)
2019-10-11 14:43 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (7.55 KB, patch)
2019-10-14 11:26 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (7.62 KB, patch)
2019-10-14 12:56 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (11.48 KB, patch)
2019-10-29 11:05 PDT, Per Arne Vollan
ggaren: review+
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews213 for win-future (13.98 MB, application/zip)
2019-10-29 12:23 PDT, EWS Watchlist
no flags Details
Patch (11.56 KB, patch)
2019-11-05 13:08 PST, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2019-10-11 14:37:13 PDT
Currently, the WebContent and Networking process is calling CFBundleGetValueForInfoDictionaryKey on startup to get the entry point function name into the WebKit bundle. This causes a mach lookup to cfprefsd which should be avoided. Instead, we can send the service name as part of the bootstrap message when the UI process is starting the process, and have the new process read this value from the message on startup to determine the name of the entry point. This is possibly also an improvement in launch time, since we avoid reading a value from Info.plist.
Comment 1 Radar WebKit Bug Importer 2019-10-11 14:37:39 PDT
<rdar://problem/56204321>
Comment 2 Per Arne Vollan 2019-10-11 14:43:42 PDT
Created attachment 380789 [details]
Patch
Comment 3 Per Arne Vollan 2019-10-14 11:26:39 PDT
Created attachment 380900 [details]
Patch
Comment 4 Brent Fulgham 2019-10-14 12:30:25 PDT
Comment on attachment 380900 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=380900&action=review

> Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:61
> +                if (!strcmp(serviceName, "com.apple.WebKit.WebContent"))

Does this work for our Development builds? (com.apple.WebKit.WebContent.Development", etc.)?

> Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:66
> +                    entryPointFunctionName = CFSTR("PluginServiceInitializer");

It's a shame that we can't define this in the relevant bundle somewhere, so that someone changing the service could easily keep the two in sync. Still, I suppose we really never change the names of these initialization functions.
Comment 5 Per Arne Vollan 2019-10-14 12:56:40 PDT
Created attachment 380908 [details]
Patch
Comment 6 Per Arne Vollan 2019-10-14 12:57:41 PDT
(In reply to Brent Fulgham from comment #4)
> Comment on attachment 380900 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=380900&action=review
> 
> > Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:61
> > +                if (!strcmp(serviceName, "com.apple.WebKit.WebContent"))
> 
> Does this work for our Development builds?
> (com.apple.WebKit.WebContent.Development", etc.)?
> 

Good catch! I have updated the patch.

> > Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm:66
> > +                    entryPointFunctionName = CFSTR("PluginServiceInitializer");
> 
> It's a shame that we can't define this in the relevant bundle somewhere, so
> that someone changing the service could easily keep the two in sync. Still,
> I suppose we really never change the names of these initialization functions.

Thanks for reviewing!
Comment 7 Per Arne Vollan 2019-10-29 11:05:30 PDT
Created attachment 382193 [details]
Patch
Comment 8 EWS Watchlist 2019-10-29 12:23:36 PDT
Comment on attachment 382193 [details]
Patch

Attachment 382193 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/13188851

New failing tests:
http/tests/misc/repeat-open-cancel.html
Comment 9 EWS Watchlist 2019-10-29 12:23:38 PDT
Created attachment 382205 [details]
Archive of layout-test-results from ews213 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews213  Port: win-future  Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Comment 10 Per Arne Vollan 2019-10-30 11:12:16 PDT
The Win EWS failure should be unrelated, since AppleWin is not compiling this.
Comment 11 Geoffrey Garen 2019-11-05 10:48:40 PST
Comment on attachment 382193 [details]
Patch

r=me
Comment 12 Per Arne Vollan 2019-11-05 10:50:26 PST
(In reply to Geoffrey Garen from comment #11)
> Comment on attachment 382193 [details]
> Patch
> 
> r=me

Thanks for reviewing!
Comment 13 WebKit Commit Bot 2019-11-05 11:36:25 PST
Comment on attachment 382193 [details]
Patch

Rejecting attachment 382193 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'land-attachment', '--force-clean', '--non-interactive', '--parent-command=commit-queue', 382193, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit

Logging in as commit-queue@webkit.org...
Fetching: https://bugs.webkit.org/attachment.cgi?id=382193&action=edit
Fetching: https://bugs.webkit.org/show_bug.cgi?id=202866&ctype=xml&excludefield=attachmentdata
Processing 1 patch from 1 bug.
Updating working directory
Processing patch 382193 from bug 202866.
Fetching: https://bugs.webkit.org/attachment.cgi?id=382193
Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	Source/WebKit/ChangeLog

ERROR from SVN:
Item is out of date: File '/trunk/Source/WebKit/ChangeLog' is out of date
W: 1ea2773e5b54fe670d6ae0438cad0fb4d82ea57b and refs/remotes/origin/master differ, using rebase:
:040000 040000 bff00d918e400d73c0067782eaaa597a330640c0 2c474c7a6cfd7c7f9686e6db48258df57f8677a3 M	Source
Current branch master is up to date.
ERROR: Not all changes have been committed into SVN, however the committed
ones (if any) seem to be successfully integrated into the working tree.
Please see the above messages for details.


Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	Source/WebKit/ChangeLog

ERROR from SVN:
Item is out of date: File '/trunk/Source/WebKit/ChangeLog' is out of date
W: 1ea2773e5b54fe670d6ae0438cad0fb4d82ea57b and refs/remotes/origin/master differ, using rebase:
:040000 040000 bff00d918e400d73c0067782eaaa597a330640c0 2c474c7a6cfd7c7f9686e6db48258df57f8677a3 M	Source
Current branch master is up to date.
ERROR: Not all changes have been committed into SVN, however the committed
ones (if any) seem to be successfully integrated into the working tree.
Please see the above messages for details.


Failed to run "['git', 'svn', 'dcommit', '--rmdir']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit
Updating OpenSource
From https://git.webkit.org/git/WebKit
   4641b5233e5..f84097b8fe5  master     -> origin/master
Partial-rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc ...
Currently at 252063 = 4641b5233e5e69039e71d0c02870b54b77a2b157
r252064 = f84097b8fe580f62c3145e62150f3ad7f7f3b567
Done rebuilding .git/svn/refs/remotes/origin/master/.rev_map.268f45cc-cd09-0410-ab3c-d52691b4dbfc
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/origin/master.

Full output: https://webkit-queues.webkit.org/results/13215903
Comment 14 Per Arne Vollan 2019-11-05 13:08:47 PST
Created attachment 382842 [details]
Patch
Comment 15 WebKit Commit Bot 2019-11-05 14:22:24 PST
Comment on attachment 382842 [details]
Patch

Clearing flags on attachment: 382842

Committed r252083: <https://trac.webkit.org/changeset/252083>