intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree
@ 2025-08-13  1:11 Stephen Rothwell
  2025-08-13  3:59 ` Andrew Morton
  2025-08-13  8:50 ` Danilo Krummrich
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Rothwell @ 2025-08-13  1:11 UTC (permalink / raw)
  To: Andrew Morton, Simona Vetter
  Cc: Danilo Krummrich, Vitaly Wool, Intel Graphics, DRI,
	Linux Kernel Mailing List, Linux Next Mailing List

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

Hi all,

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

  rust/kernel/alloc/allocator.rs

between commit:

  fde578c86281 ("rust: alloc: replace aligned_size() with Kmalloc::aligned_layout()")

from the drm-misc-fixes tree and commit:

  cda097b07bce ("rust: support large alignments in allocations")

from the mm-unstable 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 rust/kernel/alloc/allocator.rs
index 2692cf90c948,63f271624428..000000000000
--- a/rust/kernel/alloc/allocator.rs
+++ b/rust/kernel/alloc/allocator.rs
@@@ -43,11 -42,28 +42,17 @@@ pub struct Vmalloc
  /// For more details see [self].
  pub struct KVmalloc;
  
 -/// Returns a proper size to alloc a new object aligned to `new_layout`'s alignment.
 -fn aligned_size(new_layout: Layout) -> usize {
 -    // Customized layouts from `Layout::from_size_align()` can have size < align, so pad first.
 -    let layout = new_layout.pad_to_align();
 -
 -    // Note that `layout.size()` (after padding) is guaranteed to be a multiple of `layout.align()`
 -    // which together with the slab guarantees means the `krealloc` will return a properly aligned
 -    // object (see comments in `kmalloc()` for more information).
 -    layout.size()
 -}
 -
  /// # Invariants
  ///
- /// One of the following: `krealloc`, `vrealloc`, `kvrealloc`.
+ /// One of the following: `krealloc_node_align`, `vrealloc_node_align`, `kvrealloc_node_align`.
  struct ReallocFunc(
-     unsafe extern "C" fn(*const crate::ffi::c_void, usize, u32) -> *mut crate::ffi::c_void,
+     unsafe extern "C" fn(
+         *const crate::ffi::c_void,
+         usize,
+         crate::ffi::c_ulong,
+         u32,
+         crate::ffi::c_int,
+     ) -> *mut crate::ffi::c_void,
  );
  
  impl ReallocFunc {
@@@ -76,8 -92,9 +81,9 @@@
          layout: Layout,
          old_layout: Layout,
          flags: Flags,
+         nid: NumaNode,
      ) -> Result<NonNull<[u8]>, AllocError> {
 -        let size = aligned_size(layout);
 +        let size = layout.size();
          let ptr = match ptr {
              Some(ptr) => {
                  if old_layout.size() == 0 {
@@@ -134,11 -140,10 +140,12 @@@ unsafe impl Allocator for Kmalloc 
          layout: Layout,
          old_layout: Layout,
          flags: Flags,
+         nid: NumaNode,
      ) -> Result<NonNull<[u8]>, AllocError> {
 +        let layout = Kmalloc::aligned_layout(layout);
 +
          // SAFETY: `ReallocFunc::call` has the same safety requirements as `Allocator::realloc`.
-         unsafe { ReallocFunc::KREALLOC.call(ptr, layout, old_layout, flags) }
+         unsafe { ReallocFunc::KREALLOC.call(ptr, layout, old_layout, flags, nid) }
      }
  }
  
@@@ -177,19 -177,10 +179,14 @@@ unsafe impl Allocator for KVmalloc 
          layout: Layout,
          old_layout: Layout,
          flags: Flags,
+         nid: NumaNode,
      ) -> Result<NonNull<[u8]>, AllocError> {
 +        // `KVmalloc` may use the `Kmalloc` backend, hence we have to enforce a `Kmalloc`
 +        // compatible layout.
 +        let layout = Kmalloc::aligned_layout(layout);
 +
-         // TODO: Support alignments larger than PAGE_SIZE.
-         if layout.align() > bindings::PAGE_SIZE {
-             pr_warn!("KVmalloc does not support alignments larger than PAGE_SIZE yet.\n");
-             return Err(AllocError);
-         }
- 
          // SAFETY: If not `None`, `ptr` is guaranteed to point to valid memory, which was previously
          // allocated with this `Allocator`.
-         unsafe { ReallocFunc::KVREALLOC.call(ptr, layout, old_layout, flags) }
+         unsafe { ReallocFunc::KVREALLOC.call(ptr, layout, old_layout, flags, nid) }
      }
  }

[-- 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 mm-unstable tree with the drm-misc-fixes tree
  2025-08-13  1:11 linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree Stephen Rothwell
@ 2025-08-13  3:59 ` Andrew Morton
  2025-08-13  9:07   ` Danilo Krummrich
  2025-08-13  8:50 ` Danilo Krummrich
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2025-08-13  3:59 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Simona Vetter, Danilo Krummrich, Vitaly Wool, Intel Graphics, DRI,
	Linux Kernel Mailing List, Linux Next Mailing List

On Wed, 13 Aug 2025 11:11:51 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> Today's linux-next merge of the mm-unstable tree got a conflict in:
> 
>   rust/kernel/alloc/allocator.rs
> 
> between commit:
> 
>   fde578c86281 ("rust: alloc: replace aligned_size() with Kmalloc::aligned_layout()")
> 
> from the drm-misc-fixes tree and commit:
> 
>   cda097b07bce ("rust: support large alignments in allocations")
> 
> from the mm-unstable 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.
> 

Thanks.

Well that's messy.

Is it intended that the containing series ("Alloc and drm::Device
fixes") be merged into 6.17-rcX?



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

* Re: linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree
  2025-08-13  1:11 linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree Stephen Rothwell
  2025-08-13  3:59 ` Andrew Morton
@ 2025-08-13  8:50 ` Danilo Krummrich
  1 sibling, 0 replies; 4+ messages in thread
From: Danilo Krummrich @ 2025-08-13  8:50 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Andrew Morton, Simona Vetter, Vitaly Wool, Intel Graphics, DRI,
	Linux Kernel Mailing List, Linux Next Mailing List

On Wed Aug 13, 2025 at 3:11 AM CEST, Stephen Rothwell wrote:
> Hi all,
>
> Today's linux-next merge of the mm-unstable tree got a conflict in:
>
>   rust/kernel/alloc/allocator.rs
>
> between commit:
>
>   fde578c86281 ("rust: alloc: replace aligned_size() with Kmalloc::aligned_layout()")
>
> from the drm-misc-fixes tree and commit:
>
>   cda097b07bce ("rust: support large alignments in allocations")
>
> from the mm-unstable 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.

Thanks, the resolution looks good!

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

* Re: linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree
  2025-08-13  3:59 ` Andrew Morton
@ 2025-08-13  9:07   ` Danilo Krummrich
  0 siblings, 0 replies; 4+ messages in thread
From: Danilo Krummrich @ 2025-08-13  9:07 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Stephen Rothwell, Simona Vetter, Vitaly Wool, Intel Graphics, DRI,
	Linux Kernel Mailing List, Linux Next Mailing List

On Wed Aug 13, 2025 at 5:59 AM CEST, Andrew Morton wrote:
> Thanks.
>
> Well that's messy.

I think it's not too bad, the changes are just too close to each other -- no
semantic conflict.

As a general heads-up, Rust code is a bit more prone to conflicts.

On one hand this is due to the more powerful type system and components of
different subsystems being a bit closer connected to each other to provide
additional safety guarantees.

On the other hand, there's simply a lot of foundational work going on in
parallel.

For the Rust parts that are maintained under your mm tree, I think it should
generally stay well within limits though.

> Is it intended that the containing series ("Alloc and drm::Device
> fixes") be merged into 6.17-rcX?

Yes, not sure if it will be in -rc2 already, but should be in -rc3. So, the
conflict in -next should vanish in case you backmerge the corresponding -rc.

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

end of thread, other threads:[~2025-08-13  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13  1:11 linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree Stephen Rothwell
2025-08-13  3:59 ` Andrew Morton
2025-08-13  9:07   ` Danilo Krummrich
2025-08-13  8:50 ` Danilo Krummrich

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).