public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Elisei <alexandru.elisei@arm.com>
To: Andre Przywara <andre.przywara@arm.com>,
	Andrew Jones <drjones@redhat.com>
Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 5/7] lib: arm: Fallback to psci_system_off() in exit()
Date: Fri, 25 Jan 2019 16:44:39 +0000	[thread overview]
Message-ID: <1363248c-6d98-5e6d-6dfd-b26feed44823@arm.com> (raw)
In-Reply-To: <20190125161425.674e53db@donnerap.cambridge.arm.com>

On 1/25/19 4:14 PM, Andre Przywara wrote:
> On Fri, 25 Jan 2019 17:05:45 +0100
> Andrew Jones <drjones@redhat.com> wrote:
>
> Hi,
>
>> On Fri, Jan 25, 2019 at 04:31:37PM +0100, Andrew Jones wrote:
>>> On Fri, Jan 25, 2019 at 02:56:30PM +0000, Alexandru Elisei wrote:  
>>>> On 1/24/19 1:35 PM, Andrew Jones wrote:  
>>>>> On Thu, Jan 24, 2019 at 02:00:20PM +0100, Andrew Jones wrote:  
>>>>>> [..]
>>>>>> chr_testdev_init() ensures vcon is NULL if it fails to
>>>>>> initialize. chr_testdev_exit() immediately returns if vcon is
>>>>>> NULL. This was done by design to allow fallback exits to be
>>>>>> placed below the chr_testdev_exit call, e.g. halt().
>>>>>>
>>>>>> We should be able to drop patch 3/7 and change exit() to this
>>>>>>
>>>>>>   void exit(int code)
>>>>>>   {
>>>>>>       chr_testdev_exit(code);
>>>>>>       psci_system_off();
>>>>>>       halt(code);
>>>>>>       __builtin_unreachable();
>>>>>>   }
>>>>>>  
>>>>> There's also a framework for exits that can't return status
>>>>> codes. powerpc uses it. Before exiting with psci_system_off we
>>>>> need to make this print statement
>>>>>
>>>>>  printf("\nEXIT: STATUS=%d\n", ((code) << 1) | 1); 
>>>>>
>>>>> And run_qemu in arm/run needs to be changed to run_qemu_status.
>>>>> It's hacky, but maybe we can live with it until kvmtool offers
>>>>> some sort of debug exit.
>>>>>
>>>>> Thanks,
>>>>> drew  
>>>> I can make the change, but if I understand the
>>>> scripts/arch-run.bash code correctly, run_qemu() will check if
>>>> QEMU was terminated because of a signal and adjust the return
>>>> code to take that into account. Using run_qemu_status() means
>>>> that check won't be made when the tests are run under QEMU, is
>>>> that acceptable? 
>>> run_qemu_status() first calls run_qemu(). If the return value from
>>> run_qemu() is 1, then it'll change the value to whatever the EXIT:
>>> status line says it should be. If run_qemu() detected that a signal
>>> caused the exit, then the return value won't be 1. In that case
>>> run_qemu_status() will simply propagate the value to the caller.
>>>
>>> It might be worth doing a few tests to ensure that all works out as
>>> designed, but I'm pretty sure it should.
>>>  
>> It just occurred to me that you must not be using the run scripts
>> anyway, since they would require further patches to work. In that
>> case, there's no need to change arm/run unless you also provide those
>> additional patches.
>>
>> BTW, I wouldn't be opposed to a second run script, rather than trying
>> to make one script work for both qemu and kvmtool. Ideally both
>> scripts would be driven by the same higher level scripts using the
>> same unittests.cfg file though. The unittests.cfg extra_params field
>> will make that a bit challenging, but otherwise I think adding a few
>> new helper functions to scripts/arch-run.bash may be all that's
>> necessary.
> Yeah, I had some patches along those lines: split test parameters
> from QEMU parameters, abstract common stuff like number of cores and
> amount of memory, mark tests as QEMU only and so on. And I had a
> separate run script for kvmtool, IIRC.
>
> If there is interest I can try to post them, but I would consider
> this an additional effort on top of this series.
>
> Cheers,
> Andre.

I don't use the kvm-unit-tests run script, that is correct. I would prefer that
I don't change arm/run and keep the function exit() like you originally suggested:

  void exit(int code)
  {
      chr_testdev_exit(code);
      psci_system_off();
      halt(code);
      __builtin_unreachable();
  }

If anyone is interested, I or Andre can post patches for the run scripts as a separate set. Is that alright with you, Andrew?

  reply	other threads:[~2019-01-25 16:44 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 11:16 [kvm-unit-tests PATCH 0/7] arm/arm64: Add support for running under kvmtool Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 1/7] lib: arm: Discover ns16550a UART Alexandru Elisei
2019-01-24 11:54   ` Andre Przywara
2019-01-24 13:11   ` Andrew Jones
2019-01-25 14:07     ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 2/7] lib: arm: Remove warning about uart0_base mismatch Alexandru Elisei
2019-01-24 11:59   ` Andre Przywara
2019-01-24 12:37     ` Andrew Jones
2019-01-25 16:36       ` Alexandru Elisei
2019-01-25 16:47         ` Andrew Jones
2019-01-28 14:24           ` Alexandru Elisei
2019-01-28 16:31             ` Andrew Jones
2019-01-28 17:58               ` Andre Przywara
2019-01-29 10:32                 ` Andrew Jones
2019-01-29 11:16               ` Alexandru Elisei
2019-01-29 12:23                 ` Andrew Jones
2019-01-29 13:40                   ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 3/7] lib: chr-testdev: Make chr_testdev_init() return status Alexandru Elisei
2019-01-24 12:56   ` Andrew Jones
2019-01-24 11:16 ` [kvm-unit-tests PATCH 4/7] lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off() Alexandru Elisei
2019-01-24 13:01   ` Andrew Jones
2019-01-25 14:08     ` Alexandru Elisei
2019-01-25 14:25       ` Andrew Jones
2019-01-24 11:16 ` [kvm-unit-tests PATCH 5/7] lib: arm: Fallback to psci_system_off() in exit() Alexandru Elisei
2019-01-24 13:00   ` Andrew Jones
2019-01-24 13:35     ` Andrew Jones
2019-01-25 14:56       ` Alexandru Elisei
2019-01-25 15:31         ` Andrew Jones
2019-01-25 15:51           ` Alexandru Elisei
2019-01-25 16:05           ` Andrew Jones
2019-01-25 16:14             ` Andre Przywara
2019-01-25 16:44               ` Alexandru Elisei [this message]
2019-01-25 16:50                 ` Andrew Jones
2019-01-25 14:18     ` Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 6/7] lib: argv: Implement argv_find() for test parameters Alexandru Elisei
2019-01-24 11:16 ` [kvm-unit-tests PATCH 7/7] arm/arm64: Use argv_find() for test names Alexandru Elisei
2019-01-24 13:07   ` Andrew Jones
2019-01-24 13:43     ` Andre Przywara
2019-01-28 12:16     ` Alexandru Elisei

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=1363248c-6d98-5e6d-6dfd-b26feed44823@arm.com \
    --to=alexandru.elisei@arm.com \
    --cc=andre.przywara@arm.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    /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