kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: David Matlack <dmatlack@google.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Ignacio Alvarado <ikalvarado@google.com>
Subject: Re: [PATCH] KVM: selftests: Fix hang in hardware_disable_test
Date: Mon, 17 May 2021 08:15:12 +0200	[thread overview]
Message-ID: <20210517061512.tgaoivplzxbz2rmi@gator.home> (raw)
In-Reply-To: <20210514230521.2608768-1-dmatlack@google.com>

On Fri, May 14, 2021 at 11:05:21PM +0000, David Matlack wrote:
> If /dev/kvm is not available then hardware_disable_test will hang
> indefinitely because the child process exits before posting to the
> semaphore for which the parent is waiting.
> 
> Fix this by making the parent periodically check if the child has
> exited. We have to be careful to forward the child's exit status to
> preserve a KSFT_SKIP status.
> 
> I considered just checking for /dev/kvm before creating the child
> process, but there are so many other reasons why the child could exit
> early that it seemed better to handle that as general case.
> 
> Tested:
> 
> $ ./hardware_disable_test
> /dev/kvm not available, skipping test
> $ echo $?
> 4
> $ modprobe kvm_intel
> $ ./hardware_disable_test
> $ echo $?
> 0
> 
> Signed-off-by: David Matlack <dmatlack@google.com>
> ---
>  .../selftests/kvm/hardware_disable_test.c     | 32 ++++++++++++++++++-
>  1 file changed, 31 insertions(+), 1 deletion(-)
>

Reviewed-by: Andrew Jones <drjones@redhat.com>


      reply	other threads:[~2021-05-17  6:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 23:05 [PATCH] KVM: selftests: Fix hang in hardware_disable_test David Matlack
2021-05-17  6:15 ` Andrew Jones [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210517061512.tgaoivplzxbz2rmi@gator.home \
    --to=drjones@redhat.com \
    --cc=dmatlack@google.com \
    --cc=ikalvarado@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).