diff --git a/crates/reims-ctl/src/cli.rs b/crates/reims-ctl/src/cli.rs index 72e4017c4..b7f5f6ed9 100644 --- a/crates/reims-ctl/src/cli.rs +++ b/crates/reims-ctl/src/cli.rs @@ -204,8 +204,9 @@ fn report_help() -> String { line that says how it ended: its exit status, that it was stopped after {} s, or that \ vulkaninfo isn't installed (on Linux and on a Mac, the vulkan-tools package has it); \ vm.toml, the VM's settings; launch.sh, the QEMU command reims-ctl runs; state.txt, \ - whether the VM runs; and logs/, the end of each of its logs, where qemu.log says which \ - commits of reims-vgpu and metal2vulkan the VM's GPU ran on.", + whether the VM runs and, if it does, whether its GPU wrote what it counted so far into \ + qemu.log for the report; and logs/, the end of each of its logs, where qemu.log says \ + which commits of reims-vgpu and metal2vulkan the VM's GPU ran on.", logs::VULKANINFO_LIMIT.as_secs() ) } diff --git a/crates/reims-ctl/src/logs.rs b/crates/reims-ctl/src/logs.rs index bdeab8192..8bc9cf232 100644 --- a/crates/reims-ctl/src/logs.rs +++ b/crates/reims-ctl/src/logs.rs @@ -1,11 +1,13 @@ //! Bug reports: a zip of a VM's logs, its settings, the exact QEMU command, what the host is //! and vulkaninfo's whole report of it, in the downloads folder, for someone to attach to a -//! report. +//! report. A running VM's library is asked first for its degradation counts as they are then +//! ([`ask_counts`]), so its QEMU log in the zip ends with them. use crate::host::{Host, Os}; use crate::runtime; use crate::vm::Vm; use anyhow::{Context, Result}; +use serde_json::json; use std::io::Write; use std::path::{Path, PathBuf}; use std::process::Command; @@ -20,6 +22,17 @@ const LOG_CAP: u64 = 64 << 20; /// the report goes on without the rest of its output. pub const VULKANINFO_LIMIT: Duration = Duration::from_secs(30); +/// How long the ask for a running VM's counts waits for QMP's greeting and its answer: QMP takes +/// one client at a time, so the ask waits while another holds it (reims-ctl's viewer). +const COUNTS_WAIT: Duration = Duration::from_secs(3); + +/// The QOM path of a VM's display device, which qemu.rs names `gfx`. +const DISPLAY_PATH: &str = "/machine/peripheral/gfx"; + +/// The property of reims-graphics-pci whose set to true has the library write its degradation +/// counts into QEMU's log before QMP answers (vendor/qemu hw/display/reims-graphics-pci.c). +const COUNTS_PROPERTY: &str = "x-write-counts"; + pub fn bundle(vm: &Vm, host: Host) -> Result { let stamp = runtime::now_stamp("%Y%m%d-%H%M%S"); let out = crate::paths::downloads_dir().join(format!("reims-ctl-{}-{stamp}.zip", vm.name())); @@ -42,8 +55,9 @@ pub fn bundle(vm: &Vm, host: Host) -> Result { .as_bytes(), )?; } + // Before the logs are read, so that QEMU's ends with the counts as of the report. let state = match runtime::pid(vm) { - Some(p) => format!("running, pid {p}\n"), + Some(p) => format!("running, pid {p}\n{}\n", ask_counts(&vm.qmp_socket())), None => "stopped\n".to_string(), }; zip.add(&format!("{prefix}/state.txt"), state.as_bytes())?; @@ -66,6 +80,22 @@ pub fn bundle(vm: &Vm, host: Host) -> Result { Ok(out) } +/// Asks the VM on QMP's `socket` to write its library's degradation counts into its QEMU log now +/// (reims-graphics-pci's [`COUNTS_PROPERTY`]): state.txt's line that says whether it did. A VM +/// on VMware SVGA has no such property, and QMP says so. +fn ask_counts(socket: &Path) -> String { + let asked = crate::qmp::Qmp::connect(socket, COUNTS_WAIT).and_then(|mut qmp| { + let set = json!({ "path": DISPLAY_PATH, "property": COUNTS_PROPERTY, "value": true }); + qmp.execute("qom-set", Some(set)) + }); + match asked { + Ok(_) => "degradation counts: the library wrote them into logs/qemu.log for this report, \ + where it had counted any" + .to_string(), + Err(e) => format!("degradation counts: not written for this report: {e:#}"), + } +} + fn read_tail(p: &Path, cap: u64) -> Result> { use std::io::{Read, Seek, SeekFrom}; let mut f = std::fs::File::open(p)?; @@ -510,6 +540,85 @@ fn dos_now() -> (u16, u16) { mod tests { use super::*; + /// A QMP server at `sock` that greets, answers each command with `answer`, and records each + /// command but qmp_capabilities, whole. + fn fake_qmp(sock: &Path, answer: &'static str) -> Arc>> { + use std::io::BufRead; + let listener = crate::os::UnixListener::bind(sock).unwrap(); + let seen = Arc::new(Mutex::new(Vec::new())); + let record = seen.clone(); + std::thread::spawn(move || { + for mut conn in listener.incoming().map_while(Result::ok) { + let _ = conn.write_all(b"{\"QMP\": {}}\n"); + let reader = std::io::BufReader::new(conn.try_clone().unwrap()); + for line in reader.lines().map_while(Result::ok) { + let v: serde_json::Value = serde_json::from_str(&line).unwrap(); + let reply = if v["execute"] == "qmp_capabilities" { + "{\"return\": {}}" + } else { + record.lock().unwrap().push(v); + answer + }; + let _ = conn.write_all(format!("{reply}\n").as_bytes()); + } + } + }); + seen + } + + /// A running VM is asked to write its library's degradation counts with a qom-set of its + /// display device's x-write-counts property, and state.txt's line says whether it did: a + /// refusal, as a VM on VMware SVGA answers, and a socket nothing listens on say why not + #[test] + fn a_running_vm_is_asked_to_write_its_counts() { + let env = crate::testenv::Env::new("report-counts"); + // As a VM's own (`vm::qmp_socket_in`): a temporary directory's path can be past a + // socket's. + let socket = |name: &str| { + let runtime = crate::paths::runtime_dir(); + let short = crate::paths::short_runtime_dir(); + let name = format!("report-counts-{name}-{}", std::process::id()); + let s = crate::vm::qmp_socket_in(&env.root.join(&name), &name, &runtime, &short); + std::fs::create_dir_all(s.parent().unwrap()).unwrap(); + let _ = std::fs::remove_file(&s); + s + }; + let (written, refused) = (socket("written"), socket("refused")); + let asked = fake_qmp(&written, "{\"return\": {}}"); + let no = "{\"error\": {\"class\": \"GenericError\", \ + \"desc\": \"Property 'vmware-svga.x-write-counts' not found\"}}"; + let _ = fake_qmp(&refused, no); + let wrote = ask_counts(&written); + let not = ask_counts(&refused); + let none = ask_counts(&socket("none")); + for s in [&written, &refused] { + let _ = std::fs::remove_file(s); + } + let set = json!({ + "execute": "qom-set", + "arguments": { + "path": "/machine/peripheral/gfx", + "property": "x-write-counts", + "value": true, + }, + }); + assert_eq!(*asked.lock().unwrap(), [set]); + assert_eq!( + wrote, + "degradation counts: the library wrote them into logs/qemu.log for this report, where \ + it had counted any" + ); + assert_eq!( + not, + "degradation counts: not written for this report: QMP qom-set: Property \ + 'vmware-svga.x-write-counts' not found" + ); + assert!( + none.starts_with("degradation counts: not written for this report: connect to "), + "{none}" + ); + } + #[test] fn warnings_list_one_a_line_or_none() { assert_eq!(warnings_list(&[]), "none"); diff --git a/crates/reims-vgpu-c/include/reims_vgpu.h b/crates/reims-vgpu-c/include/reims_vgpu.h index ad2fba27a..7d33e913b 100644 --- a/crates/reims-vgpu-c/include/reims_vgpu.h +++ b/crates/reims-vgpu-c/include/reims_vgpu.h @@ -768,6 +768,15 @@ void rvg_graphics_device_release(RvgGraphicsDevice *device); // once, with the first answer. Calls back: never. bool rvg_quiesce_for_exit(uint64_t timeout_ms); +// Writes the library's degradation counts on stderr now, as a device's reset and the process's +// exit do: `reims-vgpu: degradation counts: , ...`, every kind counted since the process +// began, where any was and where the line changed since the library last wrote it, then the log's +// count of its repeated lines. For a host asked for them while its guest runs, so that a log read +// then has them: QEMU calls it for its device's `x-write-counts` property, which `reims-ctl +// report` sets. It takes no handle: the counts are the process's. It waits for no thread of the +// library's. Calls back: never. +void rvg_write_counts(void); + // The device's region: its first byte, page-aligned, and, through `size` where it is not NULL, // its size, a power of two. The host maps it into the guest as BAR 2, once; it is memory of the // host's process (on Linux a shared mapping of a memfd of the library's, on macOS private diff --git a/crates/reims-vgpu-c/src/graphics.rs b/crates/reims-vgpu-c/src/graphics.rs index 8ae9f462e..41ed5661b 100644 --- a/crates/reims-vgpu-c/src/graphics.rs +++ b/crates/reims-vgpu-c/src/graphics.rs @@ -837,6 +837,18 @@ pub extern "C" fn rvg_quiesce_for_exit(timeout_ms: u64) -> bool { }) } +/// Writes the library's degradation counts on stderr now, as a device's reset and the process's +/// exit do: `reims-vgpu: degradation counts: , ...`, every kind counted since the process +/// began, where any was and where the line changed since the library last wrote it, then the log's +/// count of its repeated lines. For a host asked for them while its guest runs, so that a log read +/// then has them: QEMU calls it for its device's `x-write-counts` property, which `reims-ctl +/// report` sets. It takes no handle: the counts are the process's. It waits for no thread of the +/// library's. Calls back: never. +#[unsafe(no_mangle)] +pub extern "C" fn rvg_write_counts() { + ffi::export(GraphicsDevice::::write_counts) +} + /// The device's region: its first byte, page-aligned, and, through `size` where it is not NULL, /// its size, a power of two. The host maps it into the guest as BAR 2, once; it is memory of the /// host's process (on Linux a shared mapping of a memfd of the library's, on macOS private diff --git a/crates/reims-vgpu-c/src/graphics/tests.rs b/crates/reims-vgpu-c/src/graphics/tests.rs index 551d57fa3..6febcccdf 100644 --- a/crates/reims-vgpu-c/src/graphics/tests.rs +++ b/crates/reims-vgpu-c/src/graphics/tests.rs @@ -685,3 +685,43 @@ fn a_quiesce_ahead_of_the_exit_with_nothing_to_stop_answers_true() { assert!(rvg_quiesce_for_exit(0)); assert!(rvg_quiesce_for_exit(5_000)); } + +/// The write of the counts takes no handle and writes the process's degradation counts on stderr +/// before it returns, again only where they changed since: in a child, since the counts are the +/// process's +#[test] +fn a_write_of_the_counts_writes_their_line_before_it_returns() { + const CODE: &str = "test-c-api-write-counts"; + const CHILD: &str = "RVG_WRITE_COUNTS_CHILD"; + if std::env::var_os(CHILD).is_some() { + reims_vgpu_vulkan::answer::count_kind(CODE); + rvg_write_counts(); + eprintln!("first write returned"); + rvg_write_counts(); + eprintln!("second write returned"); + reims_vgpu_vulkan::answer::count_kind(CODE); + rvg_write_counts(); + eprintln!("third write returned"); + return; + } + let test = "graphics::tests::a_write_of_the_counts_writes_their_line_before_it_returns"; + let out = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", test, "--nocapture", "--test-threads=1"]) + .env(CHILD, "1") + .output() + .unwrap(); + assert!(out.status.success(), "{out:?}"); + let stderr = String::from_utf8_lossy(&out.stderr); + let seen: Vec<&str> = (stderr.lines()) + .filter(|l| l.starts_with("reims-vgpu: degradation counts:") || l.ends_with("returned")) + .collect(); + let counted = |l: &str, n: u64| l.contains(&format!("{CODE} {n}")); + assert!( + matches!( + seen[..], + [one, "first write returned", "second write returned", two, "third write returned"] + if counted(one, 1) && counted(two, 2) + ), + "{stderr}" + ); +} diff --git a/crates/reims-vgpu-vulkan/src/answer.rs b/crates/reims-vgpu-vulkan/src/answer.rs index 0bd6650ff..9feaa0ca6 100644 --- a/crates/reims-vgpu-vulkan/src/answer.rs +++ b/crates/reims-vgpu-vulkan/src/answer.rs @@ -5,8 +5,9 @@ //! - **Counts by code** ([`count_kind`], [`count_kind_by`], [`count_made`]): kinds the library //! counts outside rt's own metrics, each under a code of its own, which the counts line //! carries ([`degradation_counts`], [`write_counts`]): `reims-vgpu: degradation counts: -//! , ...`, written at a device's reset and at the process's exit -//! ([`crate::exit_gate`]). It is the line a boot's degradations are read from +//! , ...`, written at a device's reset, at the process's exit ([`crate::exit_gate`]) and +//! when the host asks (`reims-vgpu`'s `GraphicsDevice::write_counts`, the C API's +//! `rvg_write_counts`). It is the line a boot's degradations are read from //! (docs/conventions.md). A kind's line is its caller's to log, once per kind. //! - **Out of host memory** (`out_of_host_memory`, on Linux and Windows): a map, a file or //! memory the host refused for want of mappings, files, memory or commit charge where Metal's @@ -380,11 +381,11 @@ static COUNTS_WRITTEN: crate::core::sync::Mutex = /// and where they changed since this last wrote them: `reims-vgpu: degradation counts: /// , …` ([`counts_line`]), the line the codes of a boot's degradations are read from; and the /// log's count of the lines it wrote at debug after their kind's first -/// ([`crate::core::logging::write_repeats`]). A device's reset and the process's exit write them -/// (`reims-vgpu`'s reset, [`crate::exit_gate`]). The rt platform's over-copy amounts, its -/// command buffers held for room, its cache writes, its translations, its compute dispatches and -/// its gauges at their highest are folded into the counts first -/// (`rt_platform::device::fold_metrics`). +/// ([`crate::core::logging::write_repeats`]). A device's reset, the process's exit and a host's ask +/// write them, on any thread (`reims-vgpu`'s reset and `GraphicsDevice::write_counts`, +/// [`crate::exit_gate`]). The rt platform's over-copy amounts, its command buffers held for room, +/// its cache writes, its translations, its compute dispatches and its gauges at their highest are +/// folded into the counts first (`rt_platform::device::fold_metrics`). pub fn write_counts() { crate::core::logging::write_repeats(); { diff --git a/crates/reims-vgpu-vulkan/src/core/logging.rs b/crates/reims-vgpu-vulkan/src/core/logging.rs index b8f94463b..34597b387 100644 --- a/crates/reims-vgpu-vulkan/src/core/logging.rs +++ b/crates/reims-vgpu-vulkan/src/core/logging.rs @@ -31,9 +31,9 @@ //! first digit, quote or `;` is its class ([`class`]), so a size, an address or a name in it //! makes no kind of its own. An info line that names a [`KIND`] is written once per kind too: a //! fallback each session or object may take, said once per process. [`write_repeats`] writes how -//! many lines of each kind came after its first since its last line, at a device's reset and at -//! the process's exit (`crate::answer::write_counts`). Other info lines, and debug and trace -//! lines, are written as they come: a line at info is never on a path every event takes +//! many lines of each kind came after its first since its last line, at a device's reset, at the +//! process's exit and at a host's ask (`crate::answer::write_counts`). Other info lines, and debug +//! and trace lines, are written as they come: a line at info is never on a path every event takes //! (docs/conventions.md). use std::fmt::Write as _; diff --git a/crates/reims-vgpu-vulkan/src/rt_platform/device.rs b/crates/reims-vgpu-vulkan/src/rt_platform/device.rs index a0b8c0360..b9fda0c94 100644 --- a/crates/reims-vgpu-vulkan/src/rt_platform/device.rs +++ b/crates/reims-vgpu-vulkan/src/rt_platform/device.rs @@ -329,13 +329,13 @@ //! ([`note_gauges`]): the in-run highest, to within the looks. The gauges' thread looks every 5 s //! from the process's first device's open on, whether or not its lines are in the log //! (`super::gauge_log`); so do the counts' folds ([`fold_metrics`]: a guest device's reset, after -//! its objects dropped, and the process's exit), and the let-go of a device once every handle but -//! the platform's is gone, before rt's quiesce and teardown of it (`RtPlatform::let_go_of_device`), -//! since the teardown sets every gauge to zero and the counts line of an exit after a let-go, as at -//! a host's quit, comes after it. A value rt held between two looks is not seen. The trace's -//! `rtcounts` carries the compiled kernels and the map's entries as they are at each of its events -//! (`super::command`), at most one each 50 ms while command buffers commit or complete, so a traced -//! run shows them over time. +//! its objects dropped, a host's ask for the counts and the process's exit), and the let-go of a +//! device once every handle but the platform's is gone, before rt's quiesce and teardown of it +//! (`RtPlatform::let_go_of_device`), since the teardown sets every gauge to zero and the counts +//! line of an exit after a let-go, as at a host's quit, comes after it. A value rt held between two +//! looks is not seen. The trace's `rtcounts` carries the compiled kernels and the map's entries as +//! they are at each of its events (`super::command`), at most one each 50 ms while command buffers +//! commit or complete, so a traced run shows them over time. use std::sync::{Arc, OnceLock}; diff --git a/crates/reims-vgpu-vulkan/src/rt_platform/summary.rs b/crates/reims-vgpu-vulkan/src/rt_platform/summary.rs index 8036f914d..ec5bef107 100644 --- a/crates/reims-vgpu-vulkan/src/rt_platform/summary.rs +++ b/crates/reims-vgpu-vulkan/src/rt_platform/summary.rs @@ -49,11 +49,11 @@ //! //! The syncs of copied pages (`super::copied`) have a part of their own, `rt copied: ...` //! ([`copied_line`]), from the process's counts by code (`crate::answer::counted_kinds`), which -//! the degradation counts line gives only at a device's make and reset and at the process's exit: -//! what rose since the part before, for each kind of copy (writable, read-only, unchanging) its -//! commits that synced one, the bytes the syncs went through and their time; then the read-only -//! copies' commits and bytes by the guest's why, those that rose alone. Read at the part, from -//! counts the syncs keep anyway: nothing more is done as pages are synced. +//! the degradation counts line gives only at a device's make and reset, at a host's ask and at the +//! process's exit: what rose since the part before, for each kind of copy (writable, read-only, +//! unchanging) its commits that synced one, the bytes the syncs went through and their time; then +//! the read-only copies' commits and bytes by the guest's why, those that rose alone. Read at the +//! part, from counts the syncs keep anyway: nothing more is done as pages are synced. use std::time::Duration; diff --git a/crates/reims-vgpu/src/graphics.rs b/crates/reims-vgpu/src/graphics.rs index 1147bb94c..1d7d07836 100644 --- a/crates/reims-vgpu/src/graphics.rs +++ b/crates/reims-vgpu/src/graphics.rs @@ -1396,6 +1396,17 @@ impl GraphicsDevice

{ }) }) } + + /// Writes the process's degradation counts on stderr now, as a device's reset and the + /// process's exit do (`reims_vgpu_vulkan::answer::write_counts`): the line of every kind + /// counted since the process began, where any was and where it changed since it was last + /// written, and the log's count of its repeated lines. What the C API's `rvg_write_counts` + /// does, for a host asked for them while its guest runs: QEMU's device's `x-write-counts` + /// property, which `reims-ctl report` sets before it zips QEMU's log. It waits for no thread + /// of the library's. + pub fn write_counts() { + entry::run(|_| reims_vgpu_vulkan::answer::write_counts()); + } } /// The warning of a let-go that waited out its `bound` ([`GraphicsDevice::let_go_of_gpu`]), `held` diff --git a/docs/api.md b/docs/api.md index e09eefc17..c39966d8d 100644 --- a/docs/api.md +++ b/docs/api.md @@ -225,6 +225,17 @@ an exit handler, so the handler calls none: it runs the same exit work and ends `_exit(EXIT_FAILURE)`, and the library writes no degradation counts. After the cleanup's true answer it does nothing. QEMU's trace event `reims_graphics_end` names each end through `_exit`. +### The degradation counts + +The library writes its degradation counts on stderr, one line of every kind it counted since the +process began ([conventions.md](conventions.md), "Each degradation is logged once per boot, then +counted"), at each reset of a device and at the process's exit, and when the host asks: +`rvg_write_counts`, on any thread, writes them before it returns, where the line changed since the +library last wrote it. It takes no handle, since the counts are the process's, and waits for no +thread of the library's. QEMU calls it, under the BQL, when its device's `x-write-counts` property +is set to true over QMP, which `reims-ctl report` does on a running VM before it zips QEMU's log, so +the zip has the counts as of the report. + ### The guest's Shared pool A host names the guest physical addresses it can give the guest's Shared pool @@ -277,6 +288,7 @@ Objective-C. | constants | the status codes; the PCI facts (`RVG_GRAPHICS_PCI_VENDOR_ID` 0x1234, `_DEVICE_ID` 0x5247, `_CLASS` 0x380, `RVG_GRAPHICS_PCI_BAR_REGISTERS` 0, `RVG_GRAPHICS_REGISTERS_SIZE` 4096, `RVG_GRAPHICS_MSIX_OFFSET` 2048, `RVG_GRAPHICS_MSIX_VECTORS` 1, `RVG_GRAPHICS_PCI_BAR_REGION` 2, `RVG_GRAPHICS_PCI_BAR_DOORBELLS` 4, `RVG_GRAPHICS_DOORBELLS_SIZE` 4 MiB, `RVG_GRAPHICS_DOORBELL_PAGE_SIZE` 16 KiB, `RVG_GRAPHICS_DOORBELL_PAGES` 256); `RVG_GRAPHICS_DISPLAYS_MAX` 4; the doorbell (`RVG_GRAPHICS_REG_DOORBELL`, `RVG_GRAPHICS_DOORBELL_CONTROL`); `RVG_GRAPHICS_ALLOCATIONS_OFFSET`; `RVG_GUEST_ARCH_X86_64` 0 and `RVG_GUEST_ARCH_ARM64` 1; `RVG_WINDOW_BUTTON_*`, `RVG_WINDOW_SCROLL_PHASE_*`, `RVG_WINDOW_SCROLL_MOMENTUM_*` | | status | `rvg_status_message` | | the process's exit | `rvg_quiesce_for_exit` | +| the process's degradation counts | `rvg_write_counts` | | the device | `RvgGraphicsDeviceConfig`, `RvgGuestArch`, `RvgGraphicsCallbacks` and its function types, `RvgCursorGlyph`, `RvgDisplayCoord`, `RvgMemoryMap`, `RvgMemoryRange`, `RvgMemoryRangeFile`; `rvg_graphics_device_create`, `_release`, `_region`, `_mmio_read`, `_mmio_write_taking`, `_doorbell_write`, `_set_doorbell`, `_reset`, `_read_display`, `_cursor_position`, `_read_display_at`, `_cursor_position_at`, `_pool_added`, `_pool_removed`, `_pool_grow`, `_pool_range` | | its windows | `RvgWindowConfig`, `RvgWindowCallbacks`, `RvgWindowPointerFn`, `RvgWindowWheelFn`, `RvgWindowKeyFn`, `RvgWindowCloseFn`, `RvgWindowScrollFn`, `RvgWindowScroll`; no function of their own: `RvgGraphicsDeviceConfig.window` carries display 0's, and `display_windows` those of displays 1 and up | @@ -367,6 +379,7 @@ returns. The library logs through the `log` crate; a Rust host installs its own | `rvg_graphics_device_create` | a refusal's destroys | nothing of the host's | | `rvg_graphics_device_release` | never | nothing: the threads end and the destroy runs afterwards | | `rvg_quiesce_for_exit` | never | the library's calls in progress on other threads, and the GPU's work, until its bound | +| `rvg_write_counts` | never | nothing | | `rvg_graphics_device_region` | never | nothing | | `rvg_graphics_device_mmio_read` | never | nothing | | `rvg_graphics_device_mmio_write_taking` | `raise_interrupt`, for a doorbell answered on the calling thread; `route_doorbell` and `route_doorbell_page`, dropping routes, for a STATUS write of 0, and `route_doorbell_page`, dropping a page's routes, for a `DOORBELL_PAGE_BIND` write that binds the page to another context | a STATUS write of 0: the command the control thread is taking; a `DOORBELL_PAGE_BIND` write: the queues' table, held elsewhere | diff --git a/docs/conventions.md b/docs/conventions.md index f608d82b7..fc06a39e8 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -137,8 +137,10 @@ repeats the ones code cites. Metal's call answers where it fails, each kind's first on a line of stderr naming the call, and counted: `rt-unbuilt-` and `rt-refused-` (`rt_platform::unbuilt`). - - At each reset of the device and at the process's exit, two lines give - the counts. `reims-vgpu: degradation counts: , , …`, + - At each reset of the device, at the process's exit and when the host + asks for them (`rvg_write_counts`, which QEMU's device calls when its + `x-write-counts` property is set, as `reims-ctl report` does on a + running VM), two lines give the counts. `reims-vgpu: degradation counts: , , …`, on stderr, sorted by code, is every kind relayed or counted since the process began: the platform's (`rt-unbuilt-`, `rt-refused-`, `rt-refused-texture-format-` and the other diff --git a/docs/qemu.md b/docs/qemu.md index b9dbbc85a..49aec51ae 100644 --- a/docs/qemu.md +++ b/docs/qemu.md @@ -143,6 +143,7 @@ virtio device (`d151bcd9`, upstream's `b501f21312`). | the device's realize warns where BAR 2 would get no address: on a PC machine with RAM at 1 GiB ("The reims-graphics device", below) | `b7d7fdaf` | | the window opens at the `resolution` property's size, 1920x1080 without it | `9bf62d84` | | the `displays` property, 1 to 4 (1 by default, others refused at realize): display i is head i, with a console, a window under `-display none` and a cursor of its own; console i reads display i (`rvg_graphics_device_read_display_at`), so QMP's `screendump` of head i saves it ("The reims-graphics device", below) | `010bf827` | +| the device's `x-write-counts` property: a set to true over QMP (`qom-set`, on `/machine/peripheral/gfx` as reims-ctl names the device) has the library write its degradation counts into QEMU's log then (`rvg_write_counts`), where they changed since it last wrote them; `reims-ctl report` sets it on a running VM before it zips the VM's logs | `b057a987` | | file-backed guest RAM (the memfd of `reims-ctl`'s VMs) mapped 2 MiB-aligned on Linux, as anonymous RAM is | `5e83e90dc2` | | shared file-backed guest RAM of base pages (the memfd of `reims-ctl`'s VMs) collapsed into huge pages (`MADV_COLLAPSE`) once its prealloc has run, with a line saying how much of it the collapse put on them; the device's realize fails on a Linux host below 7.2, naming its release ("Linux hosts: guest RAM's pages and the kernel's release", below) | `695ad62c`, `458f4b7b` | | `isa-applesmc` answers GET_KEY_BY_INDEX, listing its keys by name and 0xb8 past the last, so the key walk macOS 15.4 and later make at boot ends ("x86-64 macOS guests: the SMC", below) | `83de566436` | diff --git a/vendor/qemu b/vendor/qemu index 458f4b7b3..b057a987f 160000 --- a/vendor/qemu +++ b/vendor/qemu @@ -1 +1 @@ -Subproject commit 458f4b7b31ee9ac64a3a65a60f3d8adbddaec558 +Subproject commit b057a987feb64adf641921082fffaf7611373182