Page MenuHomeFreeBSD

This patch contains [[ https://github.com/dumbbell/freebsd-src/tree/linuxkpi-changes-for-drm-from-5.11 | a series of commits to linuxkpi ]] in order to support an update of the DRM drivers to match Linux 5.11:
AbandonedPublic

Authored by dumbbell on Oct 3 2022, 9:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 17 2024, 6:46 AM
Unknown Object (File)
Feb 13 2024, 10:38 PM
Unknown Object (File)
Jan 12 2024, 8:27 AM
Unknown Object (File)
Jan 4 2024, 9:45 PM
Unknown Object (File)
Dec 20 2023, 6:20 AM
Unknown Object (File)
Nov 21 2023, 7:30 AM
Unknown Object (File)
Nov 14 2023, 3:18 AM
Unknown Object (File)
Sep 21 2023, 5:37 PM

Details

Reviewers
manu
Summary
  • linuxkpi: Add __GFP_NOMEMALLOC kmalloc flag.
  • linuxkpi: Update struct irq_work. The previous llnode field is moved inside another field node. This node field is a struct __call_single_node in Linux. Here, we simply add an anonymous struct with the llnode field inside. That field's new name is llist now.
  • linuxkpi: Include <linux/shinker.h> in <linux/mm.h>. This is done like this in Linux.
  • linuxkpi: Introduce vma_set_file(). This code was moved from the i915 driver in Linux 5.11.
  • linuxkpi: Introduce module_param() of type hexint. In Linux, this affects how the value is formatted. In FreeBSD, this remains an unsigned integer.
  • linuxkpi: Add krealloc_array(). In FreeBSD, this is a wrapper on top of realloc().
  • linuxkpi: Add <acpi/actbl.h>. It simply includes the same header in FreeBSD (which is located elsewhere).
  • linuxkpi: Add <linux/page-flags.h>. It just provides a PageHighMem() macro stub.
  • linuxkpi: Add <linux/mmzone.h>. It provides the MAX_ORDER constant.
  • linuxkpi: Add <linux/dma-buf-map.h>. I took the implementation from OpenBSD, commit d55ef580b1748517027c3eabdb715316ca5b1442. The only difference is the addition of dma_buf_map_is_equal().
  • linuxkpi: Define typeof_member() in <linux/kernel.h>.
  • linuxkpi: Add seqcount_mutex_t support in <linux/seqlock.h>. To achieve that, the header uses the C11 type generic selection keyboard _Generic() because the macros are supposed to work with seqcount_t and seqcount_mutex_t.
  • linuxkpi: Add cmpxchg64() in <asm/atomic.h>. I defined it as an alias to cmpxchg(), not sure it is correct...
  • linuxkpi: Add list_for_each_entry_from_rcu() in <linux/rculist.h>.
  • linuxkpi: Add dev_warn_once() in <linux/device.h>.
  • linuxkpi: Define boot_cpu_data.x86_max_cores.
  • linuxkpi: Add <linux/mman.h> which includes <linux/smp.h>. This is used by i915_gem.c in the i915 DRM driver to get access to wbinvd_on_all_cpus().

I still have some questions:

  1. struct irq_work was changed in an incompatible way. I'm thinking of adding a #define beside the new structure so that drivers can check it to determine how to use it, and thus have a single code base working with multiple versions of FreeBSD. What do you think?
  2. I'm not sure about making cmpxchg64() an alias of cmpxchg(). It will probably break on 32bit archs.
Test Plan

There are some instructions on the GitHub pull request submitting the DRM driver update:
https://github.com/freebsd/drm-kmod/pull/163#issuecomment-1157699164

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47684
Build 44571: arc lint + arc unit

Event Timeline

dumbbell edited the summary of this revision. (Show Details)
dumbbell edited the test plan for this revision. (Show Details)
hselasky added inline comments.
sys/compat/linuxkpi/common/include/linux/slab.h
184

Are we missing any n * size overflow checks?

sys/compat/linuxkpi/common/include/linux/slab.h
184

What is the usual behavior to react to such overflow? Fail and return NULL? Panic?

If you know of an example in the kernel, could you please share it?

Can you split this review please ?

In D36869#837087, @manu wrote:

Can you split this review please ?

@dumbbell Has the split happened somewhere? I would love some of this in the tree and I assume others want the rest as well :-)

In D36869#838796, @bz wrote:

@dumbbell Has the split happened somewhere? I would love some of this in the tree and I assume others want the rest as well :-)

Not yet. I'm working on this tonight and will link the new reviews here.

Thanks, will look at those tomorrow.
Do any of those requires modifications for drm-kmod/master or 5.10-lts ?

In D36869#839616, @manu wrote:

Do any of those requires modifications for drm-kmod/master or 5.10-lts ?

The only breaking change is the modification of struct irq_work in D36955. I provide one idea to handle the incompatibility, but I'm open to suggestions.