From: Janosch Frank <frankja@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>,
Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests v2 PATCH] s390x/cpumodel: The missing DFP facility on TCG is expected
Date: Tue, 7 Jul 2020 17:09:43 +0200 [thread overview]
Message-ID: <09d34daa-a770-defd-260c-81d3c5c49a3d@linux.ibm.com> (raw)
In-Reply-To: <ca2ad96f-1d74-723f-e6c0-7345a90b35f8@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 2309 bytes --]
On 7/7/20 1:45 PM, David Hildenbrand wrote:
> On 07.07.20 13:44, Cornelia Huck wrote:
>> On Tue, 7 Jul 2020 12:42:05 +0200
>> Thomas Huth <thuth@redhat.com> wrote:
>>
>>> When running the kvm-unit-tests with TCG on s390x, the cpumodel test
>>> always reports the error about the missing DFP (decimal floating point)
>>> facility. This is kind of expected, since DFP is not required for
>>> running Linux and thus nobody is really interested in implementing
>>> this facility in TCG. Thus let's mark this as an expected error instead,
>>> so that we can run the kvm-unit-tests also with TCG without getting
>>> test failures that we do not care about.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>> v2:
>>> - Rewrote the logic, introduced expected_tcg_fail flag
>>> - Use manufacturer string instead of VM name to detect TCG
>>>
>>> s390x/cpumodel.c | 49 ++++++++++++++++++++++++++++++++++++++++++------
>>> 1 file changed, 43 insertions(+), 6 deletions(-)
>>
>> (...)
>>
>>> +static bool is_tcg(void)
>>> +{
>>> + const char qemu_ebcdic[] = { 0xd8, 0xc5, 0xd4, 0xe4 };
>>> + bool ret = false;
>>> + uint8_t *buf;
>>> +
>>> + buf = alloc_page();
>>> + if (!buf)
>>> + return false;
>>> +
>>> + if (stsi(buf, 1, 1, 1)) {
>>> + goto out;
>>> + }
>>
>> This does an alloc_page() and a stsi() every time you call it...
>>
>>> +
>>> + /*
>>> + * If the manufacturer string is "QEMU" in EBCDIC, then we are on TCG
>>> + * (otherwise the string is "IBM" in EBCDIC)
>>> + */
>>> + if (!memcmp(&buf[32], qemu_ebcdic, sizeof(qemu_ebcdic)))
>>> + ret = true;
>>> +out:
>>> + free_page(buf);
>>> + return ret;
>>> +}
>>> +
>>> +
>>> int main(void)
>>> {
>>> int i;
>>> @@ -46,11 +81,13 @@ int main(void)
>>>
>>> report_prefix_push("dependency");
>>
>> ...so maybe cache the value for is_tcg() here instead of checking
>> multiple times in the loop?
>
> Maybe move it to common code and do the detection early during boot? The
> n provide is_tcg() or sth. like that. Could be helpful in other context
> maybe.
>
Well we also already have a check for zvm 6 with stsi 3.2.2 in skey.c
I'm not completely convinced that I want to loose two pages and a few
cycles on every startup for two separate test cases.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-07-07 15:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 10:42 [kvm-unit-tests v2 PATCH] s390x/cpumodel: The missing DFP facility on TCG is expected Thomas Huth
2020-07-07 10:48 ` Thomas Huth
2020-07-07 11:44 ` Cornelia Huck
2020-07-07 11:45 ` David Hildenbrand
2020-07-07 15:09 ` Janosch Frank [this message]
2020-07-08 11:18 ` Thomas Huth
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=09d34daa-a770-defd-260c-81d3c5c49a3d@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=thuth@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