[vbox-dev] Patch for kernel 4.15-rc1

Sérgio Basto sergio at serjux.com
Fri Dec 1 19:59:15 GMT 2017


On Fri, 2017-12-01 at 11:10 -0600, Larry Finger wrote:
> On 12/01/2017 07:50 AM, Gianfranco Costamagna wrote:
> > Hello,
> > > I had that part. It fails build because the parameter of
> > > rtTimerLinuxStdCallback() needs to be "struct timer_list *t". The
> > > part I have
> > > not gotten right is how one uses that "t" to get the correct
> > > value of pSubTimer
> > > from "t" using the from_timer() macro.
> > 
> > 
> > indeed...
> > maybe something like this? (sorry can't check right now)
> > @@ -720,10 +720,18 @@ static enum hrtimer_restart
> > rtTimerLinuxHrCallback(struct hrtimer *pHrTimer)
> > *
> > * @param   ulUser      Address of the sub-timer structure.
> > */
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> > +static void rtTimerLinuxStdCallback(struct timer_list *ulUser)
> > +#else
> > static void rtTimerLinuxStdCallback(unsigned long ulUser)
> > +#endif
> > {
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> > +    PRTTIMER            pTimer    = from_timer(pTimer, ulUser,
> > aSubTimers[iCpu].u.Std.LnxTimer);
> > +#else
> > PRTTIMERLNXSUBTIMER pSubTimer = (PRTTIMERLNXSUBTIMER)ulUser;
> > PRTTIMER            pTimer    = pSubTimer->pParent;
> > +#endif
> > 
> > RTTIMERLNX_LOG(("stdcallback %p\n", pTimer));
> > if (RT_UNLIKELY(!rtTimerLnxChangeToCallbackState(pSubTimer)))
> > 
> 
> I finally got it with code that is similar to what you posted. It
> builds and works.
> 
> --- VirtualBox-5.1.30.orig/src/VBox/Runtime/r0drv/linux/timer-r0drv-
> linux.c
> +++ VirtualBox-5.1.30/src/VBox/Runtime/r0drv/linux/timer-r0drv-
> linux.c
> @@ -715,6 +715,14 @@ static enum hrtimer_restart rtTimerLinux
>   #endif /* RTTIMER_LINUX_WITH_HRTIMER */
> 
> 
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> +/**
> + * Timer callback for kernels 4.15 and later
> + */
> +static void rtTimerLinuxStdCallback(struct timer_list *t)
> +{
> +    PRTTIMERLNXSUBTIMER pSubTimer = from_timer(pSubTimer, t,
> u.Std.LnxTimer);
> +#else
>   /**
>    * Timer callback function for standard timers.
>    *
> @@ -723,6 +731,7 @@ static enum hrtimer_restart rtTimerLinux
>   static void rtTimerLinuxStdCallback(unsigned long ulUser)
>   {
>       PRTTIMERLNXSUBTIMER pSubTimer = (PRTTIMERLNXSUBTIMER)ulUser;
> +#endif
>       PRTTIMER            pTimer    = pSubTimer->pParent;
> 
>       RTTIMERLNX_LOG(("stdcallback %p\n", pTimer));
> @@ -1584,13 +1593,17 @@ RTDECL(int) RTTimerCreateEx(PRTTIMER *pp
>           else
>   #endif
>           {
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> + 
> timer_setup(&pTimer-
> >aSubTimers[iCpu].u.Std.LnxTimer,rtTimerLinuxStdCallback, 
> TIMER_PINNED);
> +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
>               init_timer_pinned(&pTimer-
> >aSubTimers[iCpu].u.Std.LnxTimer);
>   #else
>               init_timer(&pTimer->aSubTimers[iCpu].u.Std.LnxTimer);
>   #endif
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
>               pTimer->aSubTimers[iCpu].u.Std.LnxTimer.data        =
> (unsigned 
> long)&pTimer->aSubTimers[iCpu];
>               pTimer->aSubTimers[iCpu].u.Std.LnxTimer.function    = 
> rtTimerLinuxStdCallback;
> +#endif
>               pTimer->aSubTimers[iCpu].u.Std.LnxTimer.expires     =
> jiffies;
>               pTimer->aSubTimers[iCpu].u.Std.u64NextTS            =
> 0;
>           }
> 


:P not enough for rc1.git2 , I got a new error on 
VBoxGuest-linux.c:1065:35: error: initialization from incompatible
pointer type [-Werror=incompatible-pointer-types]

Best regards, 

> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> https://www.virtualbox.org/mailman/listinfo/vbox-dev
-- 
Sérgio M. B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5.1.30-4-for-4.15.0-0.rc1.git2.2.fc28.x86_64.failed.log
Type: text/x-log
Size: 37228 bytes
Desc: not available
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20171201/4d92a270/attachment.bin>


More information about the vbox-dev mailing list