Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISCV,QEMU] On QEMU reading from /proc/pid/stat file returns strange values #105686

Open
rzsc opened this issue Jul 30, 2024 · 0 comments
Open
Labels
arch-riscv Related to the RISC-V architecture area-System.Diagnostics.Process
Milestone

Comments

@rzsc
Copy link
Contributor

rzsc commented Jul 30, 2024

This issue was created to describe the reason of failure of two corefx tests built for riscv64 architecture and executed in QEMU environment on x64 architecture:

  • System.Diagnostics.Tests.ProcessTests.TestMaxWorkingSet()
  • System.Diagnostics.Tests.ProcessTests.TestMinWorkingSet()

On QEMU the method:

private static bool Interop.TryReadFile(string path, [NotNullWhen(true)] out string? contents)

defined in:

/runtime/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.TryReadStatusFile.cs

for the path parameter equal to "/proc/pid/stat", where pid is the process id executed under QEMU emulation, returns string like that:

360312 (dotnet) 0 109490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 274903147680 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

The 25th value in the string is "Current soft limit in bytes on the rss of the process" and equals to zero.

The tests expect value to be greater than zero:

      Assert.InRange() Failure: Value not in range
      Range:  (1 - 9223372036854775807)
      Actual: 0

The string read by Interop.TryReadFile() method on riscv64 VisionFive2 board is:

3179342 (dotnet) R 3179327 3179327 2796412 34817 3179327 4210688 683 0 0 0 2 0 0 0 20 0 6 0 314166288 141225422848 2836 18446744073709551615 183816348496 183816382592 274449615744 0 0 0 0 4096 17662 0 0 0 17 0 0 0 0 0 0 183816392368 183816392480 183816392704 274449616559 274449617226 274449617226 274449620912 0

and on x64 architecture is:

360089 (dotnet) R 360072 360072 109490 34820 360072 4194560 849 0 0 0 0 0 0 0 20 0 8 0 20442322 279661006848 3760 18446744073709551615 96971671317360 96971671358672 140724721806640 0 0 0 0 4096 17662 0 0 0 17 12 0 0 0 0 0 96971671368400 96971671368536 96971698143232 140724721812943 140724721813590 140724721813590 140724721815480 0

and 25th value is 18446744073709551615 for VF2 board and 18446744073709551615 for x64 architecture.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 30, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jul 30, 2024
rzsc added a commit to rzsc/runtime that referenced this issue Jul 30, 2024
System.Diagnostics.Tests.ProcessTests.TestMaxWorkingSet()
System.Diagnostics.Tests.ProcessTests.TestMinWorkingSet()

These two corefx tests fail because on QEMU the file /proc/pid/stat
contains incorrect values.

See issue dotnet#105686 for details.
@adamsitnik adamsitnik added area-System.Diagnostics.Process arch-riscv Related to the RISC-V architecture and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners untriaged New issue has not been triaged by the area owner labels Jul 30, 2024
@adamsitnik adamsitnik added this to the Future milestone Jul 30, 2024
adamsitnik pushed a commit that referenced this issue Jul 31, 2024
System.Diagnostics.Tests.ProcessTests.TestMaxWorkingSet()
System.Diagnostics.Tests.ProcessTests.TestMinWorkingSet()

These two corefx tests fail because on QEMU the file /proc/pid/stat
contains incorrect values.

See issue #105686 for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-riscv Related to the RISC-V architecture area-System.Diagnostics.Process
Projects
None yet
Development

No branches or pull requests

2 participants