From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55A7B78F52 for ; Thu, 19 Dec 2024 02:00:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734573644; cv=none; b=Y655OujQvZS+e1mo6H70tY9pxR0cSBClaXD/X+lCqVPQ9lkZZMvNmxPzkJmkMQLLxzVKGeKBRCYJW+J6vkaB2G9FsPvuPBH0bMrbtZV6oaZ3W+zs258KJpeud+jN4Rr86vgSkj2Fa+iiJs2BnUnwc3kMzONFFBanuvF94kiFgqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734573644; c=relaxed/simple; bh=6iYk8tp5iweUqouZM32221VfsqlAj53R/0rXDWBMNos=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AxN/Ae2dNeafU44oDOo7CJ4SDloM15hrLYzHOI9I/nVP/ZteXpQeeMStmoPvW0Q9q7cmpwXcNH1eLk9rxfQiGNHVfc5ilJVOQHRhwv5Hycum1nlydHMM45lvXcHwHvIzTUkYOGQWR3KdCIa5LuUK3fHxIlYN1qkQcer9KE3X+gQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UM6AjKDb; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UM6AjKDb" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-726047a4bd1so483015b3a.3 for ; Wed, 18 Dec 2024 18:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1734573642; x=1735178442; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZQ+L7roE6KPgJ2ylxUuiDIvrT0uuzVazgLVoAcXK3UA=; b=UM6AjKDbXb8TM+JwRfkeUbEHpEq8AfHqqH12O991DpPHyireKqwZRsosJS3qbP31j2 WdsVpjFep3S38a9BOmvpxBzuusHaZyWiaUjtI+Q30y4l52OEKA3vp4q/vXMMVzfk3Ves pt4R8OnxtWmct/tmvc3ldlgYHZcFq6Mfrz4Izq1GPpwQoV0cdNYVuQLbdjHFKhro2lbw ynh55ViYqegQs4AU9tih3/ehzbfksTDVNpqxiqA/0W6QJYhLMrheTD2Et2SSI17PUisq J7d6UWm+SiVF8YL/R6tmrD3ytIBlemo4SthF+dLoDm0ANEU7DVhuoU+VvWNIzEKAjo5h vOow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734573642; x=1735178442; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZQ+L7roE6KPgJ2ylxUuiDIvrT0uuzVazgLVoAcXK3UA=; b=AZgXdGO6EYIxYlAoWTHJIhdIvqesnZpk2j2qBTpli0siwO406BLo0aW0zW6kBDfZkM csp8hXRG8W0k8954917UAqdlNqfZhQbwl71gdGWhj65mMuOs0OViCNg/D3fWoeglF58x Y1lSS1dKpZgaND3jdf3qpnlW9mL0V5tGLqgbTmyeOTqEP7X1E6SDLXJhQg2JaOWOcCsj viw677AV5se8k17gOLz8iozQ9aeSZuCVj582VxjCHh8qoqv0ghp8+uxDEO2W8sIDJLEm ejA0djjtVvhywFdI9DtAyrIbVqquNfD4gFfs7Va5xVLx7XHg/W3/Bpwpw9fGhOn0Di8p Bkrg== X-Forwarded-Encrypted: i=1; AJvYcCVIX/JLQRK22leQl/xrKe9nvu+7BwOEB93Z0h3/iLfQGwtLwBS5eV9W61V70ihCz2wfgxUefJlGKAmCCnQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzsmpUrXVMbqp72KvamIs1mKZEoo5FbN+byXU+FD0JCFgK5B1eC Lne6KUoaYBwkPhA9nQQRVPZ4IVLOvDrCg77Hi5RPf2+NYZ1NivUrv2QLfrdgkOCOIh84ObCeNk0 CzA== X-Google-Smtp-Source: AGHT+IHXDAFCOLOJhGyMBJ/ocAQLcV6zAn1gzs2qkd9IFQrbChcdoamBSPIVwkZukDIfKOv3n2sIwUsU3b0= X-Received: from pgbfu11.prod.google.com ([2002:a05:6a02:4a8b:b0:7fd:5569:7b79]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:1582:b0:1e0:d6d5:39c3 with SMTP id adf61e73a8af0-1e5b45ff7camr9297733637.8.1734573642615; Wed, 18 Dec 2024 18:00:42 -0800 (PST) Date: Wed, 18 Dec 2024 18:00:41 -0800 In-Reply-To: <39f309e4a15ee7901f023e04162d6072b53c07d8.camel@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241214010721.2356923-1-seanjc@google.com> <20241214010721.2356923-10-seanjc@google.com> <39f309e4a15ee7901f023e04162d6072b53c07d8.camel@redhat.com> Message-ID: Subject: Re: [PATCH 09/20] KVM: selftests: Honor "stop" request in dirty ring test From: Sean Christopherson To: Maxim Levitsky Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Xu Content-Type: text/plain; charset="us-ascii" On Tue, Dec 17, 2024, Maxim Levitsky wrote: > On Fri, 2024-12-13 at 17:07 -0800, Sean Christopherson wrote: > > Now that the vCPU doesn't dirty every page on the first iteration for > > architectures that support the dirty ring, honor vcpu_stop in the dirty > > ring's vCPU worker, i.e. stop when the main thread says "stop". This will > > allow plumbing vcpu_stop into the guest so that the vCPU doesn't need to > > periodically exit to userspace just to see if it should stop. > > This is very misleading - by the very nature of this test it all runs in > userspace, so every time KVM_RUN ioctl exits, it is by definition an > userspace VM exit. I honestly don't see how being more precise is misleading. I'm happy to reword the changelog, but IMO just saying "exit" doesn't make it clear that the goal is to avoid the deliberate exit to the selftest's userspace side of things. The vCPU is constantly exiting to KVM for dirty logging, so to me, "periodically exit just to see if it should stop" is confusing and ambiguous. > > Add a comment explaining that marking all pages as dirty is problematic > > for the dirty ring, as it results in the guest getting stuck on "ring > > full". This could be addressed by adding a GUEST_SYNC() in that initial > > loop, but it's not clear how that would interact with s390's behavior. > > I think that this commit description should be reworked to state that s390 > doesn't support dirty ring currently so the test doesn't introduce a regression. Can do. > > Signed-off-by: Sean Christopherson > > --- > > tools/testing/selftests/kvm/dirty_log_test.c | 12 ++++++++++-- > > 1 file changed, 10 insertions(+), 2 deletions(-) > > > > diff --git a/tools/testing/selftests/kvm/dirty_log_test.c b/tools/testing/selftests/kvm/dirty_log_test.c > > index 55a385499434..8d31e275a23d 100644 > > --- a/tools/testing/selftests/kvm/dirty_log_test.c > > +++ b/tools/testing/selftests/kvm/dirty_log_test.c > > @@ -387,8 +387,7 @@ static void dirty_ring_after_vcpu_run(struct kvm_vcpu *vcpu) > > > > /* A ucall-sync or ring-full event is allowed */ > > if (get_ucall(vcpu, NULL) == UCALL_SYNC) { > > - /* We should allow this to continue */ > > - ; > > + vcpu_handle_sync_stop(); > > } else if (run->exit_reason == KVM_EXIT_DIRTY_RING_FULL) { > > /* Update the flag first before pause */ > > WRITE_ONCE(dirty_ring_vcpu_ring_full, true); > > @@ -697,6 +696,15 @@ static void run_test(enum vm_guest_mode mode, void *arg) > > #ifdef __s390x__ > > /* Align to 1M (segment size) */ > > guest_test_phys_mem = align_down(guest_test_phys_mem, 1 << 20); > > + > > + /* > > + * The workaround in guest_code() to write all pages prior to the first > > + * iteration isn't compatible with the dirty ring, as the dirty ring > > + * support relies on the vCPU to actually stop when vcpu_stop is set so > > + * that the vCPU doesn't hang waiting for the dirty ring to be emptied. > > + */ > > + TEST_ASSERT(host_log_mode != LOG_MODE_DIRTY_RING, > > + "Test needs to be updated to support s390 dirty ring"); > > This not clear either, the message makes me think that s390 does support dirty ring. > The comment above should state stat since s390 doesn't support dirty ring, > this is fine, and when/if the support is added,then the test will need to be updated. How about this? /* * The s390 workaround in guest_code() to write all pages prior to the * first iteration isn't compatible with the dirty ring test, as dirty * ring testing relies on the vCPU to actually stop when vcpu_stop is * set. If the vCPU doesn't stop, it will hang waiting for the dirty * ring to be emptied. s390 doesn't currently support the dirty ring, * and it's not clear how best to resolve the situation, so punt the * problem to the future. */ TEST_ASSERT(host_log_mode != LOG_MODE_DIRTY_RING, "Test needs to be updated to support dirty ring on s390; see comment for details");