Commit Graph

729 Commits

Author SHA1 Message Date
Alexandru Marc
191ccbe7fe Backed out changeset d92f391b3b0c (bug 1922838) for backing out bug 1915351 2024-10-25 16:42:33 +03:00
serge-sans-paille
53068cdf31 Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 09:06:01 +00:00
Alexandru Marc
83543f20f2 Backed out changeset 448597bce69d (bug 1922838) for causing build bustages. CLOSED TREE 2024-10-24 11:37:49 +03:00
serge-sans-paille
c7a369b29a Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang
Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
2024-10-24 07:38:30 +00:00
Vincent Hilla
91ed10a971 Bug 868874 - Remove Decimal::toString(char*, size_t). r=jwatt,dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D216041
2024-10-22 13:21:56 +00:00
Yannis Juglaret
072d3d69de Bug 1839299 - Use a finer-grained strategy to protect RtlLookupFunctionEntry against deadlocks. r=win-reviewers,rkraesig
On 64-bit Windows (x86_64, aarch64), stack walking relies on
RtlLookupFunctionEntry to navigate from one frame to the next. This
function acquires up to two ntdll internal locks when it is called.

The profiler and the background hang monitor both need to walk the
stacks of suspended threads. This can lead to deadlock situations,
which so far we have avoided with stack walk suppressions. We guard some
critical paths to mark them as suppressing stack walk, and we forbid
stack walking when any thread is currently on such path.

While stack walk suppression has helped remove most deadlock situations,
some can remain because it is hard to detect and manually annotate all
the paths that could lead to a deadlock situation. Another drawback is
that stack walk suppression disables stack walking for much larger
portions of code than required. For example, we disable stack walking
for LdrLoadDll, so we cannot collect stacks while we are loading a DLL.
Yet, the lock that could lead to a deadlock situation is only held
during a very small portion of the whole time spent in LdrLoadDll.

This patch addresses these two issues by implementing a finer-grained
strategy to avoid deadlock situations. We acquire the pointers to the
internel ntdll locks through a single-stepped execution of
RtlLookupFunctionEntry. This allows us to try to acquire the locks
non-blockingly so that we can guarantee safe stack walking with no
deadlock.

If we fail to collect pointers to the locks, we fall back to using stack
walk suppressions like before. This way we get the best of both worlds:
if we are confident that the situation is under control, we will use the
new strategy and get better profiler accuracy and no deadlock; in case
of doubt, we can still use the profiler thanks to stack walk
suppressions.

Differential Revision: https://phabricator.services.mozilla.com/D223498
2024-10-17 13:47:04 +00:00
Adi
70758f017d Backed out changeset e6475b7e0602 (bug 1839299) for causing instrumented build bustages. 2024-10-17 14:55:27 +03:00
Yannis Juglaret
ebdc900582 Bug 1839299 - Use a finer-grained strategy to protect RtlLookupFunctionEntry against deadlocks. r=win-reviewers,rkraesig
On 64-bit Windows (x86_64, aarch64), stack walking relies on
RtlLookupFunctionEntry to navigate from one frame to the next. This
function acquires up to two ntdll internal locks when it is called.

The profiler and the background hang monitor both need to walk the
stacks of suspended threads. This can lead to deadlock situations,
which so far we have avoided with stack walk suppressions. We guard some
critical paths to mark them as suppressing stack walk, and we forbid
stack walking when any thread is currently on such path.

While stack walk suppression has helped remove most deadlock situations,
some can remain because it is hard to detect and manually annotate all
the paths that could lead to a deadlock situation. Another drawback is
that stack walk suppression disables stack walking for much larger
portions of code than required. For example, we disable stack walking
for LdrLoadDll, so we cannot collect stacks while we are loading a DLL.
Yet, the lock that could lead to a deadlock situation is only held
during a very small portion of the whole time spent in LdrLoadDll.

This patch addresses these two issues by implementing a finer-grained
strategy to avoid deadlock situations. We acquire the pointers to the
internel ntdll locks through a single-stepped execution of
RtlLookupFunctionEntry. This allows us to try to acquire the locks
non-blockingly so that we can guarantee safe stack walking with no
deadlock.

If we fail to collect pointers to the locks, we fall back to using stack
walk suppressions like before. This way we get the best of both worlds:
if we are confident that the situation is under control, we will use the
new strategy and get better profiler accuracy and no deadlock; in case
of doubt, we can still use the profiler thanks to stack walk
suppressions.

Differential Revision: https://phabricator.services.mozilla.com/D223498
2024-10-17 09:43:15 +00:00
Emilio Cobos Álvarez
ed43bbbbb0 Bug 1922250 - Align skeleton ui with nsWindow more closely. r=win-reviewers,rkraesig
This maps better to the code we have in nsWindow, and fixes a couple
bugs which caused maximized skeleton UI-consuming windows to be
mispositioned with the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D225100
2024-10-14 10:55:25 +00:00
Noemi Erli
ffa33e3898 Backed out 3 changesets (bug 1922250) for causing failures in browser_1446343-windowsize.js CLOSED TREE
Backed out changeset f4e18a092cba (bug 1922250)
Backed out changeset 9af0852c057c (bug 1922250)
Backed out changeset c7ebee651e07 (bug 1922250)
2024-10-12 07:48:39 +03:00
Emilio Cobos Álvarez
ffb08d883e Bug 1922250 - Align skeleton ui with nsWindow more closely. r=win-reviewers,rkraesig
This maps better to the code we have in nsWindow, and fixes a couple
bugs which caused maximized skeleton UI-consuming windows to be
mispositioned with the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D225100
2024-10-11 08:37:23 +00:00
Tamas Szentpeteri
8be45dd280 Backed out changeset 4b1409597101 (bug 1920718) for causing bp bustages on rapl.cpp. 2024-10-08 23:27:18 +03:00
serge-sans-paille
069a97307f Bug 1920718 - Annotate all global variable with runtime initialization as MOZ_RUNINIT r=application-update-reviewers,media-playback-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,gfx-reviewers,aosmond,lina,nalexander,aabh
This annotation is only understood by our clang-tidy plugin. It has no
effect on regular compilation.

Differential Revision: https://phabricator.services.mozilla.com/D223341
2024-10-08 16:49:51 +00:00
Paul Adenot
da6e72dc6c Bug 1921288 - Add a way to get the associated duration type from TimeStamp and AwakeTimeStamp. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D223792
2024-10-03 08:54:11 +00:00
Paul Adenot
78ab790d8f Bug 1921288 - Add some arithmetic and conversion functions to AwakeTimeStamp. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D223791
2024-10-03 08:54:11 +00:00
Paul Adenot
3c42e9a3bc Bug 1921288 - Teach AwakeTimeStamp to do precise timestamps on Windows, rename methods. r=gsvelto
This uses a function that has been introduced in Windows 10.

Differential Revision: https://phabricator.services.mozilla.com/D223790
2024-10-03 08:54:11 +00:00
Sandor Molnar
2557cd3d7d Backed out 6 changesets (bug 1921288) for causing build bustages. CLOSED TREE
Backed out changeset c03d69e623b9 (bug 1921288)
Backed out changeset 111bef5016a9 (bug 1921288)
Backed out changeset 17130f51de88 (bug 1921288)
Backed out changeset a4acd335a710 (bug 1921288)
Backed out changeset c5fc8bc8273a (bug 1921288)
Backed out changeset 744f7a82c471 (bug 1921288)
2024-10-02 21:11:06 +03:00
Paul Adenot
3043e0394d Bug 1921288 - Fix bustage, QueryUnbiasedInterruptTimePrecise return value is void
Differential Revision: https://phabricator.services.mozilla.com/D224359
2024-10-02 16:45:10 +00:00
Paul Adenot
e3c35ceb52 Bug 1921288 - Add a way to get the associated duration type from TimeStamp and AwakeTimeStamp. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D223792
2024-10-02 16:01:04 +00:00
Paul Adenot
badc695bfb Bug 1921288 - Add some arithmetic and conversion functions to AwakeTimeStamp. r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D223791
2024-10-02 16:01:03 +00:00
Paul Adenot
72a3c75971 Bug 1921288 - Teach AwakeTimeStamp to do precise timestamps on Windows, rename methods. r=gsvelto
This uses a function that has been introduced in Windows 10.

Differential Revision: https://phabricator.services.mozilla.com/D223790
2024-10-02 16:01:03 +00:00
Florian Quèze
757717524a Bug 1915228 - Remove expired telemetry scalar startup.skeleton_ui_disabled_reason, r=win-reviewers,TravisLong,gstoll.
Depends on D220334

Differential Revision: https://phabricator.services.mozilla.com/D220335
2024-08-28 19:44:36 +00:00
Matthew Gaudet
efe3f4bd3e Bug 1904429 - Extract some core logging types into their own header file r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D217873
2024-08-23 15:52:45 +00:00
Iulian Moraru
8cff16a948 Backed out 5 changesets (bug 1904429) for causing ThreadSanitizer linux tsan failures.
Backed out changeset 787f23230ebd (bug 1904429)
Backed out changeset 81e85421af01 (bug 1904429)
Backed out changeset 9bf9011b0736 (bug 1904429)
Backed out changeset a59511524bc7 (bug 1904429)
Backed out changeset e74a80333551 (bug 1904429)
2024-08-22 23:57:12 +03:00
Matthew Gaudet
6e50ad8063 Bug 1904429 - Extract some core logging types into their own header file r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D217873
2024-08-22 17:05:59 +00:00
Nika Layzell
d0b6b794db Bug 1908725 - Part 5: Add additional validation for early-startup command line checks, r=ipc-reviewers,mccr8
This patch adjusts the various places where we initialize content
processes to call SetGeckoProcessType as early as possible, and be more
consistent. After this change we should only ever set GeckoProcessType
and GeckoChildID once per-process (with the exception of the fork server
process).

In addition to this validation, some more checks around the fork server
were added, such as to prevent forking another forkserver, or forking a
non-content process.

As part of this change, there was some refactoring/cleanup done, such as
removing plugin-container.cpp and content_process_main, as compared to
the other duplicated code between the two call-sites, the duplication
was relatively small, and inlining it helped make things more readable.

Differential Revision: https://phabricator.services.mozilla.com/D218471
2024-08-07 20:39:41 +00:00
Nika Layzell
bdb401316d Bug 1908725 - Part 2: Make the ChildID available in the same places as OtherPid, r=ipc-reviewers,media-playback-reviewers,win-reviewers,alwu,rkraesig,gfx-reviewers,mccr8,nical
This requires quite a bit of piping to get the ChildID passed everywhere where
we currently pass the pid in IPC. This is done by adding a new struct type
(EndpointProcInfo), which is passed around instead of OtherPid in these places,
and contains the full pid.

In most cases, it was a fairly painless change to move over, however in some
cases, more complex changes were required, as the pid was being stored
previously in something like an Atomic<...>, and needed to be switched to using
a mutex-protected value.

In the future, it may be possible to remove OtherPid from IPDL actors once
everything is migrated to ChildID, but we're still a long way off from that, so
for now we unfortunately need to pass both around.

Differential Revision: https://phabricator.services.mozilla.com/D217118
2024-08-07 20:39:39 +00:00
Nika Layzell
008c780b6b Bug 1908725 - Part 1: Introduce GeckoChildID, r=glandium,ipc-reviewers,mccr8
The new GeckoChildID type introduced in this patch is inspired by the existing
ContentParentID type used by ContentParent, but is currently distinct. It is
supported by all process types at the GeckoChildProcessHost level and can be
read for the current process from anywhere.

As this type is similar in many ways to the process type, and should be
available as early as possible within child processes, this was added alongside
the GeckoProcessType value within mozglue to make that easier to do.

The type was chosen to be an int32_t to make it feel similar to a PID, which we
currently use for process identity comparisons across the codebase. The
intention is for GeckoChildID to be preferred for these within-gecko checks, as
these IDs will not be re-used and can be known earlier during child process
creation.

Differential Revision: https://phabricator.services.mozilla.com/D217117
2024-08-07 20:39:39 +00:00
Sylvestre Ledru
45030f6970 Bug 1519636 - Reformat recent changes to the Google coding style r=emilio,necko-reviewers,geckoview-reviewers,application-update-reviewers,media-playback-reviewers,devtools-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,migration-reviewers,padenot,mconley,nchevobbe,kershaw,gstoll,mstange,bytesized,m_kato
This new version of clang 17 also slightly changed the formatting.

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D215914
2024-07-17 11:15:31 +00:00
Ray Kraesig
ae1ea1e8fc Bug 1903452 - [1/2] Correct coordinate conversion when cloaking and clearing window r=emilio
The previous patchset failed to properly convert the RECT to be cleared
from screen- to window-coordinates. (This wasn't noticed because the two
only differ when nontrivial chrome such as the titlebar is present,
which by default it's not.)

Differential Revision: https://phabricator.services.mozilla.com/D214334
2024-06-25 18:19:42 +00:00
Ray Kraesig
799ee37eab Bug 1824053 - [4/4] cloak and clear new window before showing it r=win-reviewers,handyman
When creating the skeleton UI window, cloak and clear it to a theme-
appropriate color before first showing it, just as is done in nsWindow.

Differential Revision: https://phabricator.services.mozilla.com/D212764
2024-06-17 14:17:50 +00:00
Ray Kraesig
e0638bd860 Bug 1824053 - [3/4] DRY up skeleton-ui dynamic-resolution code r=glandium,win-reviewers,handyman
Cleanup prior to the addition of new code. No functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D212763
2024-06-17 14:17:49 +00:00
Yannis Juglaret
99134cc647 Bug 1897479 - Filter instructions when collecting single-step data. r=rkraesig,win-reviewers
This patch introduces an aInstructionFilter argument to
CollectModuleSingleStepData to allow filtering which kind of
instructions should be recorded. We implement the All default filter and
the CallRet filter.

Differential Revision: https://phabricator.services.mozilla.com/D211196
2024-06-03 12:24:41 +00:00
Yannis Juglaret
adbf392846 Bug 1897479 - Abstract away single-step data collection for reusability. r=rkraesig,win-reviewers
This patch makes the single-step data collection code that we
implemented for bug 1571516 reusable, while preserving its behavior.
No functional changes, except for a slight reordering of the
error-result enum.

We define a generic CollectSingleStepData function that embeds the
magic for starting to trigger single step exceptions and for acting upon
them.

We define a more specialized CollectModuleSingleStepData function which
can be reused if the purpose of single step data collection is to
monitor what paths are taken within a specific module. It stores the
collected data in stack, so that it can be accessed from crash reports.

This code is considered unstable and thus only available in Nightly and
early Beta and only used on paths that are known to crash already.

Differential Revision: https://phabricator.services.mozilla.com/D211195
2024-06-03 12:24:41 +00:00
Patrycja Rosa
32e1cf70a0 Bug 1882329 - Make StackWalk Linux support check more specific r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D202862
2024-05-27 21:46:09 +00:00
serge-sans-paille
b9f78f0cc2 Bug 1883615 - Move libdl checks to moz.configure and make libdl dependencies explicit r=glandium
The -ldl flag was previously set globally, it's now set for the libs
that use it.

Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H.

Differential Revision: https://phabricator.services.mozilla.com/D203594
2024-05-15 20:29:07 +00:00
Tamas Szentpeteri
22c92af506 Backed out 3 changesets (bug 1883720, bug 1883719, bug 1883615) for causing multiple failures. CLOSED TREE
Backed out changeset 495b9e84ba9d (bug 1883720)
Backed out changeset 5a89cbc54dd2 (bug 1883615)
Backed out changeset 9d075e352b0e (bug 1883719)
2024-05-15 13:30:17 +03:00
serge-sans-paille
863475a670 Bug 1883615 - Move libdl checks to moz.configure and make libdl dependencies explicit r=glandium
The -ldl flag was previously set globally, it's now set for the libs
that use it.

Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H.

Differential Revision: https://phabricator.services.mozilla.com/D203594
2024-05-15 07:47:55 +00:00
Emilio Cobos Álvarez
50eb344091 Bug 1893532 - Improve error message of HTMLInputElement.stepUp/stepDown. r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D208671
2024-05-01 00:11:33 +00:00
Tamas Szentpeteri
a86fd1fb23 Backed out changeset 4309f75eaa90 (bug 1883615) for causing build bustages related to check_symbol_in_libs. CLOSED TREE 2024-04-17 12:57:02 +03:00
serge-sans-paille
78ac6a6ccf Bug 1883615 - Move libdl checks to moz.configure and make libdl dependencies explicit r=glandium
The -ldl flag was previously set globally, it's now set for the libs
that use it.

Also rationalize the difference between HAVE_DLOPEN and HAVE_DLFCN_H.

Differential Revision: https://phabricator.services.mozilla.com/D203594
2024-04-17 09:33:00 +00:00
Denis Palmeiro
a37693bbe8 Bug 1887068: Add perfetto event traces for taskcontroller tasks and dom performance measurement markers. r=smaug
Depends on D205662

Differential Revision: https://phabricator.services.mozilla.com/D205663
2024-04-15 15:34:04 +00:00
Cristina Horotan
fd5658787a Backed out 4 changesets (bug 1887068, bug 1890934) on request by causing build bustages
Backed out changeset 68a7a8a3bb0f (bug 1890934)
Backed out changeset 658f4b57b8ec (bug 1887068)
Backed out changeset 61a9d3a1e592 (bug 1887068)
Backed out changeset efbf5c7065e3 (bug 1887068)
2024-04-12 02:14:44 +03:00
Denis Palmeiro
7a98a8955a Bug 1887068: Add perfetto event traces for taskcontroller tasks and dom performance measurement markers. r=smaug
Depends on D205662

Differential Revision: https://phabricator.services.mozilla.com/D205663
2024-04-10 17:48:08 +00:00
Cristian Tuns
8fdef5ff9e Backed out 3 changesets (bug 1887068) for causing build bustages in toolkit/* CLOSED TREE
Backed out changeset c6863f012b03 (bug 1887068)
Backed out changeset 3a4d2b74219e (bug 1887068)
Backed out changeset 90a702920d77 (bug 1887068)
2024-04-09 18:19:08 -04:00
Denis Palmeiro
bea9a256f9 Bug 1887068: Add perfetto event traces for taskcontroller tasks and dom performance measurement markers. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D205663
2024-04-09 19:05:36 +00:00
Gabriele Svelto
7e71a11603 Bug 1872920 - Change how we notify the main process when we intercept a crash via WER r=yjuglaret,bobowen
This patch makes several fundamental changes to the logic we use to inform
the main process whenever the WER runtime exception module intercepts a child
process crash:

* We no longer read the process type or any other data from the child process;
  the process type is passed as the runtime exception module's context
* We no longer read the address of the memory area used to communicate with the
  main process from the child process arguments. Instead we allocate memory
  directly into the main process and store the required information there
* We don't read anything from the main process either, the pointer to the
  function used to notify the main process is now found by looking out its
  dedicated section in the parent process' xul.dll mapping
* We no longer read the OOM crash annotation from a child process, this
  functionality will be restored by making the module use the mozannotation
  crates to fetch all the annotations

Differential Revision: https://phabricator.services.mozilla.com/D201589
2024-02-21 17:56:31 +00:00
Markus Stange
b75080bb8b Bug 1876415 - Make timestamp formats consistent between Jitdump and the marker file. r=glandium
On Linux and Android, both jitdump and the marker file will keep using
`CLOCK_MONOTONIC` nanoseconds, as before.

On macOS, both jitdump and the marker file will now be using
`TimeStamp::RawMachAbsoluteTimeNanoseconds()` , i.e. "nanoseconds since
mach_absolute_time origin".
This value has the advantage that it is also relatively easy to obtain
in other browser engines, because their internal timestamp value is stored
in milliseconds or nanoseconds rather than in `mach_absolute_time` ticks.
In the past, on macOS, Firefox was using `CLOCK_MONOTONIC` nanoseconds for
jitdump and `TimeStamp::RawMachAbsoluteTimeValue()` for the marker file.
This inconsistency is now fixed.
I will update samply to change how it treats jitdump timestamps on macOS.
There are no other consumers of jitdump files on macOS that I know of.

On Windows, we will keep using raw QPC values for the marker file - this
matches what's in the ETW events. Jitdump on Windows is mostly unused but
I'm updating it to match.

Furthermore, this fixes the order in mozglue/misc/moz.build to make sure
we always use the TimeStamp_darwin implementation on Darwin (and not just
due to a broken configure check, see bug 1681445), and it fixes the #ifdef
in TimeStamp.h to match the Darwin check.

Differential Revision: https://phabricator.services.mozilla.com/D199592
2024-01-26 03:38:54 +00:00
Botond Ballo
3d749c7613 Bug 1855079 - On 32-bit ARM, ignore the least significant bit of the address in the comparison in ShouldSkipPC. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D197745
2024-01-21 00:56:50 +00:00
Steve Fink
ba7d3327fc Bug 1790873 - Move printf_stderr() to mozglue so it can be used within js/src r=glandium,nika
Differential Revision: https://phabricator.services.mozilla.com/D157354
2024-01-11 02:09:30 +00:00