Re: [PATCH v2 2/3] cobalt/rtdm: Prepare for new signature of mm_get_unmapped_area() in 6.19

Jan Kiszka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
On 24.02.26 17:02, Florian Bezdeka wrote:
> On Fri, 2026-02-20 at 16:25 +0100, Jan Kiszka wrote:
>> On 20.02.26 12:27, Florian Bezdeka wrote:
>>> Since 6.19 the signature of mm_get_unmapped_area() has one parameter
>>> less. The (previously) first struct mm_struct *mm parameter has been
>>> removed.
>>>
>>> Signed-off-by: Florian Bezdeka <[email protected]>
>>> ---
>>>  kernel/cobalt/rtdm/drvlib.c | 8 ++++++--
>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/cobalt/rtdm/drvlib.c b/kernel/cobalt/rtdm/drvlib.c
>>> index 86788743fe47b228662ef16831b4281ddefd04ff..0258100db5bbcc04880ddc71632b7992e50168dc 100644
>>> --- a/kernel/cobalt/rtdm/drvlib.c
>>> +++ b/kernel/cobalt/rtdm/drvlib.c
>>> @@ -1907,8 +1907,12 @@ driver_get_unmapped_area(struct file *filp,
>>>  
>>>  #ifdef CONFIG_MMU
>>>  	/* Run default handler. */
>>> -	return mm_get_unmapped_area(current->mm, filp, addr, len, pgoff,
>>> -				    flags);
>>> +#if LINUX_VERSION_CODE < KERNEL_VERSION(6,19,0)
>>> +	return mm_get_unmapped_area(current->mm, filp, addr, len, pgoff, flags);
>>> +#else
>>> +	return mm_get_unmapped_area(filp, addr, len, pgoff, flags);
>>> +#endif
>>
>> -> wrappers.h, extending the existing logic there, using the latest
>> pattern here.
>>
> 
> Just realized that this function has more history in wrapping:
> 
> #if LINUX_VERSION_CODE < KERNEL_VERSION(6,10,0)
> #define mm_get_unmapped_area(__mm, __filp, __addr, __len, __pgoff, __flags) \
> 	(__mm)->get_unmapped_area(__filp, __addr, __len, __pgoff, __flags)
> #endif
> 
> Kernel versions < 6.19 will need 6 parameters, >= 6.19 will need 5. The
> callers of the wrapper macro must agree in the number of parameters.
> 
> As we cannot touch other callers (Linux code), we have to align the
> caller to the kernel version. I'm running out of ideas here...
> 

The wrapper will only affect Xenomai users, thus does not need to worry
about other code in the kernel.

I'm not quite sure I understand the problem now, why you cannot
translate the inline wrapping above into a xenomai-generic one that
expands the 5-args call to 6 (using current->mm).

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.