Re: [kvm-unit-tests PATCH 2/4] lib: s390x: sclp: Extend feature probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 11 May 2021 17:46:45 +0200
Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx> wrote:

> On Tue, 11 May 2021 17:38:04 +0200
> David Hildenbrand <david@xxxxxxxxxx> wrote:
> 
> > On 11.05.21 16:41, Claudio Imbrenda wrote:  
> > > On Tue, 11 May 2021 13:43:36 +0200
> > > David Hildenbrand <david@xxxxxxxxxx> 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@xxxxxxxxxxxxx>
> > >>> Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> > >>> ---
> > >>>    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 :)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux