Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#32 RTKit support for Linux

v2.3
open
gpz
None
new Feature
2013-06-16
2010-10-16
Linus Walleij
No

This adds RTKit support to VICE. If it is not explicitly disabled during
autoconf, we will check for D-Bus, then if D-Bus is found, RTKit will
be used to attempt elevate the VICE main process to realtime scheduling
at RT priority 4. If that fails, it will back down priorities or request a high
nice level (also using RTKit) if realtime fails altogether.

This makes running VICE considerably smoother on this Fedora 13
machine at least.

Based on Lennart Poetterings RTKit example code (BSD licensed).

Discussion

  • Linus Walleij
    Linus Walleij
    2010-10-16

    Patch for RTKit support

     
    Attachments
  • Linus Walleij
    Linus Walleij
    2010-10-17

    Assigning to someone who seems to be altering Unix code...

     
  • Linus Walleij
    Linus Walleij
    2010-10-17

    • assigned_to: nobody --> gpz
     
  • gpz
    gpz
    2010-10-20

    mmh i tried it, unfortunately it doesnt even compile for me:

    rtkit.c: In function 'vice_rtkit_make_realtime':
    rtkit.c:267: error: 'SCHED_RESET_ON_FORK' undeclared (first use in this function)
    rtkit.c:267: error: (Each undeclared identifier is reported only once
    rtkit.c:267: error: for each function it appears in.)

    i havent used rtkit myself, so no idea how to fix this =P

    another thing, please have a look at docs/coding-guidelines.txt and fix the indention and use of curly braces (4 spaces for indention, not tabs - always use braces, never omit them).

    (kf, is that you? :))

     
  • Linus Walleij
    Linus Walleij
    2010-10-21

    Patch for RTKit support v2

     
    Attachments
  • Linus Walleij
    Linus Walleij
    2010-10-21

    Aha I read some other RTKit code and notice that sometimes
    SCHED_RESET_ON_FORK isn't properly included in the glibc.
    I've implemented a kludge similar to what RTKit itself uses.
    (If the kernel is new enough it'll still work I believe.)

    Fedora 13 and later have all the necessary features in place,
    I don't know about Debian, Ubuntu etc... Karmic uses it atleast.

    I have checked the coding guidelines and I think I follow them,
    atleast I did my best,

    Another thing: I really wanted to make RTKit optional at build
    time but as far as I can tell the autoconf macros are all intended
    to try to detect everything, there is only opt-out never opt-in...
    I guess this is intentional. It shouldn't hurt anyway.

    And yes. I am indeed King Fisher / TRIAD, happy to meet you
    here! :-)

     
  • gpz
    gpz
    2010-10-30

    ok so, played around some more...

    > Aha I read some other RTKit code and notice that sometimes SCHED_RESET_ON_FORK isn't properly included in the glibc. I've implemented a kludge similar to what RTKit itself uses. (If the kernel is new enough it'll still work I believe.)

    that part seems to work for me now, after installing rtkit =)

    > I have checked the coding guidelines and I think I follow them, atleast I did my best,
    yeah, looks good

    > Another thing: I really wanted to make RTKit optional at build time but as far as I can tell the autoconf macros are all intended to try to detect everything, there is only opt-out never opt-in... I guess this is intentional. It shouldn't hurt anyway.

    the general idea is indeed to build a "full featured" binary by default. however, for example ffmpeg support should be "opt-in".

    > And yes. I am indeed King Fisher / TRIAD, happy to meet you here! :-)
    :)

    anyway, the bad news is... after applying this patch vice runs extremely unstable for me. ie, it starts up, and whenever i do something non trivial it immediatly quits with a "killed" message (which doesnt help a lot with finding out wth the problem is).

    this might very well be a distro related problem (i am using gentoo, rtkit is relativly new there) - or maybe also the fact that my pc is old and slow (amd64@2.2ghz). however, whatever it is... it clearly forbids to enable this feature by default :)

    for a start i guess it would be a good idea if you could do the following:
    - create a resource "rtkitenabled" (toggle) and make the default 0
    - add commandline options -rtkit and +rtkit to set that resource to 1 or 0
    - only use rtkit if the resource is 1
    (just look up how one of the other "toggle" type commandline option works, move all related handlers and tables into your rtkit source etc)

    that way nothing will break for anyone who doesn't explicitly enable rtkit support on the commandline, and the patch can be added even if certain problems persist.

    mmmh, and maybe an option to manipulate the actual priority could be helpful too ? :)

     
  • gpz
    gpz
    2011-07-03

    just for the records, i have not forgotten this one :) however, merging this patch properly (in an arch independent way) is some more work, so it has to wait until some of the bugs that are piling up are fixed :)

     
  • gpz
    gpz
    2013-06-16

    • Version: --> v2.3
    • Category: --> new Feature