Re: [PATCH 4.4 15/50] s390/alternative: use a copy of the facility bit mask

From: Jiri Slaby
Date: Fri May 04 2018 - 03:37:30 EST


On 04/27/2018, 03:58 PM, Greg Kroah-Hartman wrote:
> 4.4-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
>
>
> [ Upstream commit cf1489984641369611556bf00c48f945c77bcf02 ]
>
> To be able to switch off specific CPU alternatives with kernel parameters
> make a copy of the facility bit mask provided by STFLE and use the copy
> for the decision to apply an alternative.
...
> --- a/arch/s390/include/asm/facility.h
> +++ b/arch/s390/include/asm/facility.h
> @@ -13,6 +13,24 @@
>
> #define MAX_FACILITY_BIT (256*8) /* stfle_fac_list has 256 bytes */

I wonder if the below (plus __test_facility) is correct in 4.4, given
MAX_FACILITY_BIT is defined as such and not as sizeof(stfle_fac_list *
8) as in upstream?

> +static inline void __set_facility(unsigned long nr, void *facilities)
> +{
> + unsigned char *ptr = (unsigned char *) facilities;
> +
> + if (nr >= MAX_FACILITY_BIT)
> + return;
> + ptr[nr >> 3] |= 0x80 >> (nr & 7);
> +}
> +
> +static inline void __clear_facility(unsigned long nr, void *facilities)
> +{
> + unsigned char *ptr = (unsigned char *) facilities;
> +
> + if (nr >= MAX_FACILITY_BIT)
> + return;
> + ptr[nr >> 3] &= ~(0x80 >> (nr & 7));
> +}
> +
> static inline int __test_facility(unsigned long nr, void *facilities)
> {
> unsigned char *ptr;
> --- a/arch/s390/include/asm/lowcore.h
> +++ b/arch/s390/include/asm/lowcore.h
> @@ -170,7 +170,8 @@ struct _lowcore {
> __u8 pad_0x0e20[0x0f00-0x0e20]; /* 0x0e20 */
>
> /* Extended facility list */
> - __u64 stfle_fac_list[32]; /* 0x0f00 */
> + __u64 stfle_fac_list[16]; /* 0x0f00 */
> + __u64 alt_stfle_fac_list[16]; /* 0x0f80 */
> __u8 pad_0x1000[0x11b0-0x1000]; /* 0x1000 */

thanks,
--
js
suse labs