summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/gsp_sema_service.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/kernel/gsp_sema_service.c b/kernel/gsp_sema_service.c
index ccccfec..143ec54 100644
--- a/kernel/gsp_sema_service.c
+++ b/kernel/gsp_sema_service.c
@@ -12120,6 +12120,7 @@ static struct workqueue_struct *svc_fwd_wq;
static unsigned long svc_fwd_state;
static u64 svc_fwd_requests;
static u64 svc_fwd_dropped;
+static u32 svc_grvaudit_launches; /* GRVAUDIT: per-launch audit counter */
/*
* Pause gate shared by the pump's request path and the backend release path:
* quiesce takes this lock, sets paused and waits for the in-flight work item;
@@ -13569,6 +13570,10 @@ static void svc_fwd_gr_work(void)
struct gsp_phys_backend_copy_result cp = { 0 };
u64 rel_hpa = 0;
u32 off = 0, i;
+ /* GRVAUDIT: aggregated from the data[]-build loop below (first
+ * problem page in ga_va/ga_used/ga_led; 0 while clean). */
+ u32 ga_unlanded = 0, ga_ptebad = 0;
+ u64 ga_va = 0, ga_used = 0, ga_led = 0;
int hw_rc;
memset(&gs, 0, sizeof(gs));
@@ -13654,6 +13659,41 @@ static void svc_fwd_gr_work(void)
data[gs.n_data].hpa = dhpa;
data[gs.n_data].reloc_va = dg->reloc_va;
/*
+ * GRVAUDIT (diagnostic only): audit the m180 landing
+ * authority against the PA this submit will put on the wire
+ * for every tracked data page - the data[]/n_data set the
+ * backend's NOWRITE analysis later enumerates. The lookup
+ * runs BEFORE the store underneath re-records this launch's
+ * own landing, so it reads the pre-existing authority:
+ * unlanded = no landing recorded for this VA at submit;
+ * pte_bad = a landing exists on a different page/aperture
+ * than the PA the submit path computed/used. Pages below
+ * SVC_VAS_FLOOR are outside the ledger's domain (all store
+ * sites gate on the floor) and are not classified.
+ */
+ if (dg->va >= SVC_VAS_FLOOR) {
+ u64 lpa = 0;
+ u32 lap = 0;
+
+ if (svc_ledger_lookup(dg->va, &lpa, &lap)) {
+ ga_unlanded++;
+ if (!ga_va) {
+ ga_va = dg->va;
+ ga_used = dg->pa;
+ ga_led = 0;
+ }
+ } else if ((lpa & ~(u64)(SEMA_PAGE_SIZE - 1)) !=
+ (dg->pa & ~(u64)(SEMA_PAGE_SIZE - 1)) ||
+ (u32)lap != (u32)dkind) {
+ ga_ptebad++;
+ if (!ga_va) {
+ ga_va = dg->va;
+ ga_used = dg->pa;
+ ga_led = lpa;
+ }
+ }
+ }
+ /*
* C3 (data class): after the run the backend copies this
* page's results back to dg->pa (gsp_phys_booter.c copy-out).
* Record that page as the truth for this VA so the guest's
@@ -13693,6 +13733,17 @@ static void svc_fwd_gr_work(void)
gs.raw_qmd_end = svc_fwd_req.gr_push_qmd_end;
gs.h_object = svc_fwd_req.gr_h_object;
+ /*
+ * GRVAUDIT: one line per launch (n_data matches the backend
+ * NOWRITE line's req->n_data); nonzero counts always log, an
+ * all-clean audit logs once per 50 launches.
+ */
+ svc_grvaudit_launches++;
+ if (ga_unlanded || ga_ptebad || !(svc_grvaudit_launches % 50u))
+ pr_info("vgsp-gr: GRVAUDIT n_data=%u unlanded=%u pte_bad=%u sample_va=0x%llx pa_used=0x%llx ledger_pa=0x%llx\n",
+ gs.n_data, ga_unlanded, ga_ptebad,
+ ga_va, ga_used, ga_led);
+
hw_rc = gsp_phys_backend_guest_gr_submit(&gs, &cp);
if (!hw_rc) {
svc.fwd_gr_ok++;