This is more consistent with Linux, and in the !PMAP_HAS_DMAP case we
are returning wired pages as well.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
There is some code in the TTM that I wish to remove following this commit. What's the right way to conditionalize that code? __FreeBSD_version is too heavyweight IMO.
I'm guessing we would also have to revert this recent fix https://github.com/FreeBSDDesktop/kms-drm/commit/4d4b2baf9cbc22588fd379e158c717030bce0d29 ?
We could use LINUXKPI_VERSION if you want to do something like this:
// gfp.h
static inline struct page *
alloc_page(gfp_t flags)
{
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50001
return (linux_alloc_pages(flags & WIRE, 0));
#else
return (linux_alloc_pages(flags, 0));
#endif
}
This way nothing breaks until drivers are updated ( for drm 13-CURRENT supports two branches, 4.16 and 5.0, we need to make sure neither breaks).
LINUXKPI_VERSION macro was added to allow updates to linuxkpi without breaking existing clients. Drivers that use linuxkpi define the version they need. Once all clients are up to the latest linuxkpi version we can remove the condition.
Yes. There is similar code in the TTM that I was going to remove as well.
We could use LINUXKPI_VERSION if you want to do something like this:
// gfp.h
static inline struct page *
alloc_page(gfp_t flags)
{#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50001
return (linux_alloc_pages(flags & WIRE, 0));
#else
return (linux_alloc_pages(flags, 0));
#endif
}
This way nothing breaks until drivers are updated ( for drm 13-CURRENT supports two branches, 4.16 and 5.0, we need to make sure neither breaks).
LINUXKPI_VERSION macro was added to allow updates to linuxkpi without breaking existing clients. Drivers that use linuxkpi define the version they need. Once all clients are up to the latest linuxkpi version we can remove the condition.
I want the same behaviour for both 4.16 and 5.0, so this doesn't quite work: as far as I can see, 4.16 doesn't define LINUXKPI_VERSION.
I want the same behaviour for both 4.16 and 5.0, so this doesn't quite work: as far as I can see, 4.16 doesn't define LINUXKPI_VERSION.
It doesn't define it because 4.16 is the fallback/default. LINUXKPI_VERSION was introduced with 5.0.
Predicate the change on LINUXKPI_VERSION.
Use the new behaviour for DRM 4.16 since we do not have code
relying on the old behaviour.
sys/compat/linuxkpi/common/src/linux_page.c | ||
---|---|---|
96 ↗ | (On Diff #58201) | Any LINUXKPI_VERSION checks would have to go in the header files since drm drivers, who declare it, are built from ports... That's why my example was for change in gfp.h. |
sys/compat/linuxkpi/common/src/linux_page.c | ||
---|---|---|
96 ↗ | (On Diff #58201) | I see now, sorry. I implemented a NOTWIRED flag, so that when 50000 support is dropped we can just delete all of the added code. |
Elegant solution! I will ponder a bit over where's the best place to declare LINUXKPI_VERSION in the DRM repo. The best of course would be to have it in one single place, like the root makefile since both drm drivers and linuxkpi_gplv2 depends on it and there's no guarantee that a certain linux header is always included.