linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the kvm tree with the drm-xe tree
@ 2024-02-22  3:58 Stephen Rothwell
  2024-02-22 10:42 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2024-02-22  3:58 UTC (permalink / raw)
  To: Paolo Bonzini, Lucas De Marchi, Oded Gabbay, Thomas Hellström
  Cc: DRM XE List, KVM, Linux Kernel Mailing List,
	Linux Next Mailing List, Yury Norov

[-- Attachment #1: Type: text/plain, Size: 3552 bytes --]

Hi all,

Today's linux-next merge of the kvm tree got a conflict in:

  include/linux/bits.h

between commits:

  b77cb9640f1f ("bits: introduce fixed-type genmasks")
  34b80df456ca ("bits: Introduce fixed-type BIT")

from the drm-xe tree and commit:

  3c7a8e190bc5 ("uapi: introduce uapi-friendly macros for GENMASK")

from the kvm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc include/linux/bits.h
index 811846ce110e,0eb24d21aac2..000000000000
--- a/include/linux/bits.h
+++ b/include/linux/bits.h
@@@ -4,10 -4,9 +4,11 @@@
  
  #include <linux/const.h>
  #include <vdso/bits.h>
+ #include <uapi/linux/bits.h>
  #include <asm/bitsperlong.h>
  
 +#define BITS_PER_TYPE(type)	(sizeof(type) * BITS_PER_BYTE)
 +
  #define BIT_MASK(nr)		(UL(1) << ((nr) % BITS_PER_LONG))
  #define BIT_WORD(nr)		((nr) / BITS_PER_LONG)
  #define BIT_ULL_MASK(nr)	(ULL(1) << ((nr) % BITS_PER_LONG_LONG))
@@@ -33,42 -29,11 +34,42 @@@
   * disable the input check if that is the case.
   */
  #define GENMASK_INPUT_CHECK(h, l) 0
 +#define BIT_INPUT_CHECK(type, b) 0
  #endif
  
 -#define GENMASK(h, l) \
 -	(GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
 -#define GENMASK_ULL(h, l) \
 -	(GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
 +/*
 + * Generate a mask for the specified type @t. Additional checks are made to
 + * guarantee the value returned fits in that type, relying on
 + * shift-count-overflow compiler check to detect incompatible arguments.
 + * For example, all these create build errors or warnings:
 + *
 + * - GENMASK(15, 20): wrong argument order
 + * - GENMASK(72, 15): doesn't fit unsigned long
 + * - GENMASK_U32(33, 15): doesn't fit in a u32
 + */
- #define __GENMASK(t, h, l) \
++#define ___GENMASK(t, h, l) \
 +	(GENMASK_INPUT_CHECK(h, l) + \
 +	 (((t)~0ULL - ((t)(1) << (l)) + 1) & \
 +	 ((t)~0ULL >> (BITS_PER_TYPE(t) - 1 - (h)))))
 +
- #define GENMASK(h, l)		__GENMASK(unsigned long,  h, l)
- #define GENMASK_ULL(h, l)	__GENMASK(unsigned long long, h, l)
- #define GENMASK_U8(h, l)	__GENMASK(u8,  h, l)
- #define GENMASK_U16(h, l)	__GENMASK(u16, h, l)
- #define GENMASK_U32(h, l)	__GENMASK(u32, h, l)
- #define GENMASK_U64(h, l)	__GENMASK(u64, h, l)
++#define GENMASK(h, l)		___GENMASK(unsigned long,  h, l)
++#define GENMASK_ULL(h, l)	___GENMASK(unsigned long long, h, l)
++#define GENMASK_U8(h, l)	___GENMASK(u8,  h, l)
++#define GENMASK_U16(h, l)	___GENMASK(u16, h, l)
++#define GENMASK_U32(h, l)	___GENMASK(u32, h, l)
++#define GENMASK_U64(h, l)	___GENMASK(u64, h, l)
 +
 +/*
-  * Fixed-type variants of BIT(), with additional checks like __GENMASK().  The
++ * Fixed-type variants of BIT(), with additional checks like ___GENMASK().  The
 + * following examples generate compiler warnings due to shift-count-overflow:
 + *
 + * - BIT_U8(8)
 + * - BIT_U32(-1)
 + * - BIT_U32(40)
 + */
 +#define BIT_U8(b)		((u8)(BIT_INPUT_CHECK(u8, b) + BIT(b)))
 +#define BIT_U16(b)		((u16)(BIT_INPUT_CHECK(u16, b) + BIT(b)))
 +#define BIT_U32(b)		((u32)(BIT_INPUT_CHECK(u32, b) + BIT(b)))
 +#define BIT_U64(b)		((u64)(BIT_INPUT_CHECK(u64, b) + BIT(b)))
  
  #endif	/* __LINUX_BITS_H */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the kvm tree with the drm-xe tree
  2024-02-22  3:58 linux-next: manual merge of the kvm tree with the drm-xe tree Stephen Rothwell
@ 2024-02-22 10:42 ` Paolo Bonzini
  2024-03-01 18:17   ` Lucas De Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2024-02-22 10:42 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Lucas De Marchi, Oded Gabbay, Thomas Hellström, DRM XE List,
	KVM, Linux Kernel Mailing List, Linux Next Mailing List,
	Yury Norov

On Thu, Feb 22, 2024 at 4:58 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Hi all,
>
> Today's linux-next merge of the kvm tree got a conflict in:
>
>   include/linux/bits.h
>
> between commits:
>
>   b77cb9640f1f ("bits: introduce fixed-type genmasks")
>   34b80df456ca ("bits: Introduce fixed-type BIT")
>
> from the drm-xe tree and commit:
>
>   3c7a8e190bc5 ("uapi: introduce uapi-friendly macros for GENMASK")
>
> from the kvm tree.
>
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.

Lucas, Oded, Thomas,

do you have a topic branch that I can merge?

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the kvm tree with the drm-xe tree
  2024-02-22 10:42 ` Paolo Bonzini
@ 2024-03-01 18:17   ` Lucas De Marchi
  2024-03-01 18:38     ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Lucas De Marchi @ 2024-03-01 18:17 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Stephen Rothwell, Oded Gabbay, Thomas Hellström,
	DRM XE List, KVM, Linux Kernel Mailing List,
	Linux Next Mailing List, Yury Norov

On Thu, Feb 22, 2024 at 11:42:01AM +0100, Paolo Bonzini wrote:
>On Thu, Feb 22, 2024 at 4:58 AM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>>
>> Hi all,
>>
>> Today's linux-next merge of the kvm tree got a conflict in:
>>
>>   include/linux/bits.h
>>
>> between commits:
>>
>>   b77cb9640f1f ("bits: introduce fixed-type genmasks")
>>   34b80df456ca ("bits: Introduce fixed-type BIT")
>>
>> from the drm-xe tree and commit:
>>
>>   3c7a8e190bc5 ("uapi: introduce uapi-friendly macros for GENMASK")
>>
>> from the kvm tree.
>>
>> I fixed it up (see below) and can carry the fix as necessary. This
>> is now fixed as far as linux-next is concerned, but any non trivial
>> conflicts should be mentioned to your upstream maintainer when your tree
>> is submitted for merging.  You may also want to consider cooperating
>> with the maintainer of the conflicting tree to minimise any particularly
>> complex conflicts.
>
>Lucas, Oded, Thomas,
>
>do you have a topic branch that I can merge?

Yury set up a new tree and the patch we had in drm-xe-next will
(eventually) go through that tree.  We also had some issues with those
patches, so they are currently on the back burner. Current discussion
going on at https://lore.kernel.org/intel-xe/20240208074521.577076-1-lucas.demarchi@intel.com/T/#mc0d83438c5b6164eabea85bb3b5eef7503dade84

I'm surprised to see 3c7a8e190bc5 ("uapi: introduce uapi-friendly macros
for GENMASK") with no acks from maintainer though. Btw, aren't you
missing some includes in include/uapi/linux/bits.h?

thanks
Lucas De Marchi

>
>Paolo
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linux-next: manual merge of the kvm tree with the drm-xe tree
  2024-03-01 18:17   ` Lucas De Marchi
@ 2024-03-01 18:38     ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2024-03-01 18:38 UTC (permalink / raw)
  To: Lucas De Marchi
  Cc: Stephen Rothwell, Oded Gabbay, Thomas Hellström,
	DRM XE List, KVM, Linux Kernel Mailing List,
	Linux Next Mailing List, Yury Norov

On 3/1/24 19:17, Lucas De Marchi wrote:
> I'm surprised to see 3c7a8e190bc5 ("uapi: introduce uapi-friendly macros
> for GENMASK") with no acks from maintainer though.

The patch sat on the list for a couple months, then I went ahead and 
committed it.

The changes to include/linux/bits.h are just code movement from kernel 
to uapi header (plus the uglification of BITS_PER_LONG and 
BITS_PER_LONG_LONG per uapi rules) so I think that's fine.

But I'll drop an email to them to ask them if they want MAINTAINERS to 
include the new file.

> Btw, aren't you missing some includes in include/uapi/linux/bits.h?

Yeah, uapi/linux/const.h is needed to use the macros in bits.h.  I 
didn't notice because KVM headers include it anyway and, on the 
include/linux/ side, include/linux/bits.h gets it via include/linux/const.h.

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-01 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22  3:58 linux-next: manual merge of the kvm tree with the drm-xe tree Stephen Rothwell
2024-02-22 10:42 ` Paolo Bonzini
2024-03-01 18:17   ` Lucas De Marchi
2024-03-01 18:38     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).