[roll] Roll fuchsia [vm][pi] Fix priority inheritance in StackOwnedLoanedPagesInterval

The StackOwnedLoadedPagesInterval is an RAII construct involved in
loaning and reclaiming loan-able pages.  It allows VM code to
temporarily prevent stack owned pages from being reclaimed during
certain operations.

Recently, eieio@ was investigating some unrelated issues while running
on top of fxr/658374 (a change which moves us away from priority
inheritance, and in the direction of actual generalized profile
inheritance) when he tripped a bookkeeping assert in the new patch
stack.

Investigation of the stack led back to this code which is a bespoke
user of the OwnedWaitQueue code.  It is attempting to transmit profile
pressure from threads who want their loaned pages back to the thread
who is currently performing an operation with those pages and cannot
give them back (just yet).

This is all fine and good, but unfortunately some of the rules of
using OwnedWaitQueues were not being followed.  In particular, OWQ
inherits from the base WaitQueue, but there are some operations which
should never be done via the WaitQueue interface when the WaitQueue
happens to also be an OwnedWaitQueue.  Instead, those operations
should always go through the OWQ interface.

Specifically, threads blocking in an OWQ need to always go through
BlockAndAssignOwner, not the WaitQueue's Block.  Failure to do this
means that the OWQ bookkeeping will not be updated, and no
Priority/Profile pressure will be transmitted.

This got missed by the tests here because there was a mistaken
assumption that there was no way to test to see if PI was actually
working (there is, and there are a number of PI tests which already do
so).

So;
++ Update the existing tests to make sure that PI is actually
   operating properly.
++ While updating the tests, implement a few other cleanups as
   well, such as using fit::defer to RAII style cleanup the test if it
   needs to exit early, and heap allocating the test structures
   instead of stack allocating them (just because kernel stacks are
   particularly small).
++ Change OWQ from public inheritance of WaitQueue to protected
   inheritance, and publish a very limited list of base WaitQueue
   methods which can be called by a user who knows for certain that
   they are interacting with an OwnedWaitQueue instead of just a
   WaitQueue.
++ Add a runtime assert to the Block path of WaitQueue which asserts
   that the magic number is valid, but that it does not indicate that
   this is actually a OwnedWaitQueue.  Threads which are blocking in
   an OWQ should always know that they are doing so, and this assert
   can help to catch any future cases where they might accidentally
   try to Block in something which is an OWQ instead of a WQ.

Original-Fixed: 110318
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/729331
Original-Revision: c167a260af9d94c00bbac43dcd9b1997b47dc11d
GitOrigin-RevId: 920c08d6b55f82f76ba73858232e254badc1fbd1
Change-Id: Iab2fdd8675af63ae6c70df72b416bc86a7469c9c
1 file changed
tree: 15ae88b620d475eca9e8c940b45953ee76499f7b
  1. git-hooks/
  2. infra/
  3. third_party/
  4. cts
  5. firmware
  6. flower
  7. jiri.lock
  8. minimal
  9. prebuilts
  10. README.md
  11. stem
  12. test_durations
  13. toolchain
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.