From: Cornelia Huck <cohuck@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>,
Janosch Frank <frankja@linux.ibm.com>,
kvm@vger.kernel.org, linux-s390@vger.kernel.org,
thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH 2/4] lib: s390x: sclp: Extend feature probing
Date: Tue, 11 May 2021 18:36:22 +0200 [thread overview]
Message-ID: <20210511183622.1251155d.cohuck@redhat.com> (raw)
In-Reply-To: <20210511174645.550c741d@ibm-vm>
On Tue, 11 May 2021 17:46:45 +0200
Claudio Imbrenda <imbrenda@linux.ibm.com> wrote:
> On Tue, 11 May 2021 17:38:04 +0200
> David Hildenbrand <david@redhat.com> wrote:
>
> > On 11.05.21 16:41, Claudio Imbrenda wrote:
> > > On Tue, 11 May 2021 13:43:36 +0200
> > > David Hildenbrand <david@redhat.com> wrote:
> > >
> > >> On 10.05.21 17:00, Janosch Frank wrote:
> > >>> Lets grab more of the feature bits from SCLP read info so we can
> > >>> use them in the cpumodel tests.
> > >>>
> > >>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> > >>> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> > >>> ---
> > >>> lib/s390x/sclp.c | 20 ++++++++++++++++++++
> > >>> lib/s390x/sclp.h | 38 +++++++++++++++++++++++++++++++++++---
> > >>> 2 files changed, 55 insertions(+), 3 deletions(-)
> > >>>
> > >>> diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
> > >>> index f11c2035..f25cfdb2 100644
> > >>> --- a/lib/s390x/sclp.c
> > >>> +++ b/lib/s390x/sclp.c
> > >>> @@ -129,6 +129,13 @@ CPUEntry *sclp_get_cpu_entries(void)
> > >>> return (CPUEntry *)(_read_info +
> > >>> read_info->offset_cpu); }
> > >>>
> > >>> +static bool sclp_feat_check(int byte, int mask)
> > >>> +{
> > >>> + uint8_t *rib = (uint8_t *)read_info;
> > >>> +
> > >>> + return !!(rib[byte] & mask);
> > >>> +}
> > >>
> > >> Instead of a mask, I'd just check for bit (offset) numbers within
> > >> the byte.
> > >>
> > >> static bool sclp_feat_check(int byte, int bit)
> > >> {
> > >> uint8_t *rib = (uint8_t *)read_info;
> > >>
> > >> return !!(rib[byte] & (0x80 >> bit));
> > >> }
> > >
> > > using a mask might be useful to check multiple facilities at the
> > > same time, but in that case the check should be
> >
> > IMHO checking with a mask here multiple facilities will be very error
> > prone either way ... and we only have a single byte to check for.
>
> as I said, I do not have a strong opinion either way :)
>
>
If you need a tie breaker, I'd vote for bit over mask :)
next prev parent reply other threads:[~2021-05-11 16:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-10 15:00 [kvm-unit-tests PATCH 0/4] s390x: cpumodel: Add sclp checks Janosch Frank
2021-05-10 15:00 ` [kvm-unit-tests PATCH 1/4] s390x: sclp: Only fetch read info byte 134 if cpu entries are above it Janosch Frank
2021-05-11 11:39 ` David Hildenbrand
2021-05-11 16:32 ` Cornelia Huck
2021-05-10 15:00 ` [kvm-unit-tests PATCH 2/4] lib: s390x: sclp: Extend feature probing Janosch Frank
2021-05-11 11:43 ` David Hildenbrand
2021-05-11 14:41 ` Claudio Imbrenda
2021-05-11 15:38 ` David Hildenbrand
2021-05-11 15:46 ` Claudio Imbrenda
2021-05-11 16:36 ` Cornelia Huck [this message]
2021-05-10 15:00 ` [kvm-unit-tests PATCH 3/4] s390x: cpumodel: FMT4 SCLP test Janosch Frank
2021-05-11 11:45 ` David Hildenbrand
2021-05-11 14:42 ` Claudio Imbrenda
2021-05-10 15:00 ` [kvm-unit-tests PATCH 4/4] s390x: cpumodel: FMT2 SCLP implies test Janosch Frank
2021-05-11 11:46 ` David Hildenbrand
2021-05-11 14:36 ` Claudio Imbrenda
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=20210511183622.1251155d.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@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