Commit Graph

218 Commits

Author SHA1 Message Date
marc audy
2c4ef8db33 add new core delegates (OnParentBeginFork, OnParentPreFork, OnPostFork, OnEndFramePostFork) to allow interested parties a chance to take actions before and after the process fork point on dedicated servers
#jira UE-143512
#rb louisphilippe.seguin
#preflight
[REVIEW] [at]sam.zamani [at]rob.cannaday

#ROBOMERGE-OWNER: marc.audy
#ROBOMERGE-AUTHOR: evan.kinney
#ROBOMERGE-SOURCE: CL 19102416 via CL 19103934 via CL 19106412 via CL 19106558 via CL 19110150
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)
#ROBOMERGE-CONFLICT from-shelf

[CL 19151456 by marc audy in ue5-main branch]
2022-02-25 13:23:06 -05:00
Brandon Schaefer
526de2431d Fix %z warning about not being supported. We only support %zu for these
#jira none
#rb none
#fyi Rob.Millar
#preflight none

[CL 19113673 by Brandon Schaefer in ue5-main branch]
2022-02-24 10:13:15 -05:00
Michael Sartain
d775be7af4 Added check for running on ChromeOS to FUnixPlatformMisc::GetOSVersions
#rb none
#fyi Brandon.Schaefer
#jira none
#preflight trivial

[CL 19093918 by Michael Sartain in ue5-main branch]
2022-02-23 12:07:26 -05:00
robert millar
b4bfddef0a MallocBinned2 fork support.
Clear caches and update a canary value across the fork boundary to avoid touching pages that were allocated pre-fork to minimize unnecessary duplication of shared pages.
Savings depend on pre-fork fragmentation/slack and number of concurrent child processes.

#rb louisphilippe.seguin, johan.torp, arciel.rekman

#ROBOMERGE-OWNER: robert.millar
#ROBOMERGE-AUTHOR: robert.millar
#ROBOMERGE-SOURCE: CL 19057122 via CL 19057644 via CL 19057693 via CL 19057718 via CL 19057737 via CL 19059617
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v918-19018356)

[CL 19066314 by robert millar in ue5-main branch]
2022-02-21 02:04:42 -05:00
brian bekich
a602343183 Adding timestamps to child fork signals
Adding optional child process timeout for WAIT_AND_FORK_RESPONSE_SIGNAL
Added logging if we fail to set the child command line

#rb louisphilippe.seguin, brandon.schaefer

#ROBOMERGE-AUTHOR: brian.bekich
#ROBOMERGE-SOURCE: CL 19050891 via CL 19050899 via CL 19050911 via CL 19057425
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v918-19018356)

[CL 19066039 by brian bekich in ue5-main branch]
2022-02-21 01:10:42 -05:00
robert millar
5780df4d5a Log out page size on startup
#rb none

#ROBOMERGE-AUTHOR: robert.millar
#ROBOMERGE-SOURCE: CL 19038494 via CL 19038585 via CL 19038593 via CL 19039371 via CL 19039472 via CL 19039992
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v918-19018356)

[CL 19040355 by robert millar in ue5-main branch]
2022-02-17 15:10:04 -05:00
Michael Sartain
6d5c76511c Linux: Use PCI-Id information if NVIDIA driver returns Unknown GPU
Seems like v495 and v510 drivers are giving us this:

  $ cat /proc/driver/nvidia/gpus/**/information
  Model: 		 Unknown
  IRQ:   		 150
  GPU UUID: 	 ...
  Video BIOS: 	 90.04.7a.00.9d
  Bus Type: 	 PCIe
  DMA Size: 	 47 bits
  DMA Mask: 	 0x7fffffffffff
  Bus Location: 	 0000:4b:00.0
  Device Minor: 	 0
  GPU Excluded:	 No

#jira none
#rb none
#fyi Thomas.Convard, Brandon.Schaefer
#preflight trivial

[CL 19022851 by Michael Sartain in ue5-main branch]
2022-02-16 16:26:58 -05:00
michael sartain
519d35a87f Add USE_PROC_SELF_SMAPS_ROLLUP define for FUnixPlatformMemory::GetExtendedStats
Set to 1 if we should try to use /proc/self/smaps_rollup in FUnixPlatformMemory::GetExtendedStats().
There is a potential tradeoff in that smaps_rollup appears to be quite a bit faster in
straight testing, but it also looks like it blocks mmap() calls on other threads until it finishes.

Also move /proc/self/smaps code to use open/read/close and read + parse in 512 byte chunks instead of
fopen to avoid malloc calls in fopen/fgets.

[REVIEW] [at]Brandon.Schaefer, [at]Ilya.Loshchinin
#preflight trivial

#ROBOMERGE-OWNER: michael.sartain
#ROBOMERGE-AUTHOR: michael.sartain
#ROBOMERGE-SOURCE: CL 19001314 via CL 19004045 via CL 19004552 via CL 19005213 via CL 19008130 via CL 19008739
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)
#ROBOMERGE-CONFLICT from-shelf

[CL 19009893 by michael sartain in ue5-main branch]
2022-02-15 22:27:38 -05:00
Brandon Schaefer
5f923daf74 Move the command line switches outside of the if/else FORCE_ANSI loop as the command line switches are no longer allocator only. Related to UE-71155, but that jira will be the proper fix to this madness
#jira none
#rb Michael.Sartain, Robert.Seiver
#preflight 6206ec8654003c49ad4d7326

[CL 18964966 by Brandon Schaefer in ue5-main branch]
2022-02-11 18:22:34 -05:00
Michael Sartain
604a29bdbe Modify FUnixPlatformMemory::GetStats and GetExtendedStats to use open/read/close
fopen/fgets both allocate memory and we're potentially hitting contention when multithreaded

Also remove the freebsd code and clean up everything to use common ReadProcFields function

#jira none
#review-18926623 @Brandon.Schaefer, @Robert.Seiver, @Ilya.Loshchinin
#preflight trivial

[CL 18953210 by Michael Sartain in ue5-main branch]
2022-02-11 11:17:38 -05:00
ilya loshchinin
9c5fa9d45b Added child offset number to linux parent server logs, to help trace issues related to forking.
#rb brian.bekich,louisphilippe.sequin

#ROBOMERGE-AUTHOR: ilya.loshchinin
#ROBOMERGE-SOURCE: CL 18921917 via CL 18922093 via CL 18922253 via CL 18922705 via CL 18923830
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v916-18915374)

[CL 18923842 by ilya loshchinin in ue5-main branch]
2022-02-09 15:34:11 -05:00
Michael Sartain
d09ba57823 Implement FUnixPlatformMisc::GetPrimaryGPUBrand()
For NVIDIA, should return something like:

  "NVIDIA GeForce RTX 3080 Ti (NVIDIA UNIX x86_64 Kernel Module  470.86  Tue Oct 26 21:55:45 UTC 2021)"

And AMD Mesa:

  "AMD PCI-id: 1002-731f (1462-3811)"

#review-18888533 @Brandon.Schaefer, @Robert.Seiver
#fyi Thomas.Convard
#jira UE-141264
#preflight trivial

[CL 18889756 by Michael Sartain in ue5-main branch]
2022-02-07 13:56:08 -05:00
louisphilippe seguin
6183fac75d PerfCounters
* Added -forkautostatsport cmdline option that automatically sets a unique port for each forked child. Ports used will start at  statsPort+1.
* Improved statsport /exec listener so it returns a different error message when the exec callback isn't registered, the cmd itself was not processed by the exec or the cmd is missing the 'c=' param.

Forking
* Exposed ChildProcessIndex in ForkHelper

[REVIEW] Brandon.Schaeffer, Brian.Bekich

#ROBOMERGE-AUTHOR: louisphilippe.seguin
#ROBOMERGE-SOURCE: CL 18770568 via CL 18770579 via CL 18770587 via CL 18774066 via CL 18774960
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18775041 by louisphilippe seguin in ue5-main branch]
2022-01-28 13:38:55 -05:00
brandon schaefer
27d91d317d Fix FMallocLinked destroying the link list by setting the head to nullptr even if there was a proper ->Next pointer
#rb none

#ROBOMERGE-AUTHOR: brandon.schaefer
#ROBOMERGE-SOURCE: CL 18736027 via CL 18736038 via CL 18736049 via CL 18736609 via CL 18737342
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18737663 by brandon schaefer in ue5-main branch]
2022-01-26 12:31:15 -05:00
michael sartain
3957eeb144 Read proc smaps_rollup in FUnixPlatformMemory::GetExtendedStats() if it exists
smaps_rollup was added in v4.14. Details on this page:
  https://kernelnewbies.org/Linux_4.14

It should be a constant ~1ms vs 6.8ms (and far higher) when reading entire smaps file
  (Tested on my 5.15 kernel)

smaps_rollup info:
  https://patchwork.kernel.org/project/linux-fsdevel/patch/20170812022148.178293-1-dancol[at]google.com/

Smaps info:
> FPlatformMemory::GetExtendedStats() is slow and took 28ms in my local tests.
> Moreover, it can be even slower because the time it takes is a (hopefully
> linear) function of the number of memory allocations.

#jira UE-139749, UE-52126
[REVIEW] Brandon.Schaefer, Arciel.Rekman
[FYI] Brian.Bekich, Ilya.Loshchinin, Robert.Seiver
#preflight trivial

#ROBOMERGE-AUTHOR: michael.sartain
#ROBOMERGE-SOURCE: CL 18683396 via CL 18683443 via CL 18683460 via CL 18684028 via CL 18684035 via CL 18684055
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v902-18672795)

[CL 18684069 by michael sartain in ue5-main branch]
2022-01-20 18:41:56 -05:00
michael sartain
fc8351a183 Added FUnixPlatformFile::CopyFile() that differs from the generic implementation in that it also copies the file permission bits.
This is similar to CL 2421073, 2424491 for FApplePlatformFile.

[at]Brandon.Schaefer, [at]Robert.Seiver
[FYI] Will.Damon
#jira none
#preflight trivial

#ROBOMERGE-AUTHOR: michael.sartain
#ROBOMERGE-SOURCE: CL 18604349 in //UE5/Release-5.0/... via CL 18604376 via CL 18604394
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18604413 by michael sartain in ue5-main branch]
2022-01-13 15:57:24 -05:00
zach brockway
dd2ebf0e26 Allow FUnixPlatformProcess::CreateProc to locate executables within $PATH, rather than requiring an absolute path.
Changed underlying API from posix_spawn to posix_spawnp, which only differs in behavior if the provided path fragment does not contain any path separators. Matches within the base directory are still prioritized if they exist. Failures are no longer treated as fatal.

#jira UE-138792
#rb Brandon.Schaefer, Michael.Sartain
#preflight 61ddd69fcd2cced71060929a

#ROBOMERGE-AUTHOR: zach.brockway
#ROBOMERGE-SOURCE: CL 18575611 in //UE5/Release-5.0/... via CL 18575644
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18575658 by zach brockway in ue5-release-engine-test branch]
2022-01-11 14:51:19 -05:00
michael sartain
3e2943820e Add Linux -crashhandlerstacksize command line option to set crash handler stack size
Also move stack to mmap'd memory instead of alloc'ing in heap

Should allow us to set & reduce size of 200k stack significantly via command line.

Brandon.Schaefer
#jira none
#preflight 61dc61cb1f62d3ad4d8079d4

#ROBOMERGE-AUTHOR: michael.sartain
#ROBOMERGE-SOURCE: CL 18561402 in //UE5/Release-5.0/... via CL 18561404
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18561421 by michael sartain in ue5-release-engine-test branch]
2022-01-10 12:18:10 -05:00
jack porter
e7b6f0102c Add flag to FPlatformProcess::CreatePipe to indicate the pipe will be used for stdin redirection rather than stdout redirection.
Windows needs to set permissions accordingly.
#rb Brandon.Schaefer
[FYI] Josh.Adams
#preflight 61d79ed84c252480ca31e640

#ROBOMERGE-AUTHOR: jack.porter
#ROBOMERGE-SOURCE: CL 18539045 in //UE5/Release-5.0/... via CL 18539064
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18539081 by jack porter in ue5-release-engine-test branch]
2022-01-06 21:19:58 -05:00
devin doucette
0a6eb275ba StringBuilder: Deprecated AppendAnsi
#rb Zousar.Shaker
#preflight 61d4bfb3411c1403a3bfab2a

#ROBOMERGE-AUTHOR: devin.doucette
#ROBOMERGE-SOURCE: CL 18523803 in //UE5/Release-5.0/... via CL 18523820
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)

[CL 18523837 by devin doucette in ue5-release-engine-test branch]
2022-01-05 15:20:34 -05:00
ilya loshchinin
90ba7e6dec Fixed Unix crash messages printing a truncated memory address.
#tests Crashed on Linux with nullptr and non-null ptr
#rb Brandon.Schaefer
#preflight 61b245cafb3115178686b4a7

#ROBOMERGE-AUTHOR: ilya.loshchinin
#ROBOMERGE-SOURCE: CL 18422416 via CL 18422444 via CL 18422465 via CL 18435085 via CL 18437383
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18437661 by ilya loshchinin in ue5-release-engine-test branch]
2021-12-10 20:58:57 -05:00
Marc Audy
0c3be2b6ad Merge Release-Engine-Staging to Test @ CL# 18240298
[CL 18241953 by Marc Audy in ue5-release-engine-test branch]
2021-11-18 14:37:34 -05:00
brandon schaefer
b38e3cac6e Move Warning to Verbose for possible leaked process. Its been around for a long time and while could still be an issue, not enough to spam the logs
#jira none
#rb Michael.Sartain

#ROBOMERGE-AUTHOR: brandon.schaefer
#ROBOMERGE-SOURCE: CL 17476778 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17476795 by brandon schaefer in ue5-release-engine-test branch]
2021-09-09 17:45:42 -04:00
geordiemhall
1c5bfd52de Implement OutStdErr in FUnixPlatformProcess::ExecProcess
Add stderr parameter to CreateProc
Add exec-process test to TestPAL

PR #6919: Add a new FPlatformProcess::CreateProc() overload to allow separating stderr and stdout (Contributed by geordiemhall)

#rb Brandon.Schaefer, James.Singer, Robert.Seiver, Will.Damon
#jira UE-91758, UE-92964

#ROBOMERGE-SOURCE: CL 17290306 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v861-17282326)

[CL 17290325 by geordiemhall in ue5-release-engine-test branch]
2021-08-24 14:16:10 -04:00
johan torp
272087e936 Fix OnOutOfMemory thread-safety issue when concurrent calls return from the function
Change all FPlatformMemory::OnOutOfMemory implementations to [[noreturn]]

#jira UE-93728
#rb steve.robb, arciel.rekman

#ROBOMERGE-SOURCE: CL 17212898 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17212911 by johan torp in ue5-release-engine-test branch]
2021-08-18 06:20:03 -04:00