Latest patch available

Here you can download the latest FBFS patches available.

FreeBSD-8.2

This patch is for the FreeBSD sources synchronized against the cvsup branch tag RELENG_8_2.

The patch can be downloaded from here.

FreeBSD 8-STABLE

This patch is for the FreeBSD sources synchronized against the cvsup branch tag RELENG_8.

The patch can be downloaded from here.

FreeBSD CURRENT

Fidaj has ported the patch for the version RELENG_8_2 to the FreeBSD CURRENT. Thank you!

The patch can be downloaded from here. Please notice that this patch is a patch only to the /usr/src/sys/kern/sched_fbfs.c file. So to use this patch, firstly download and apply the patch for the FreeBSD-8.2 version. Then just cd into the /usr/src/sys/kern directory and apply the patch.

Applying the patch and compiling the FreeBSD kernel with FBFS scheduler included

Firstly a quick warning. Here I write a quick guide how to compile the FBFS scheduler into the FreeBSD. Although I have tried to do my best, it is possible that the following procedure could make your system unstable or even unbootable. So use common sense, do not apply it to production systems:-) The scheduler is still under development.

Now I assume you are running the 8.2-RELEASE version of the FreeBSD operating system. It is the latest version available for download from the official FreeBSD web page. You can get it from here. If you are running the FreeBSD 8-STABLE branch of the FreeBSD operating system, just use the RELENG_8 cvsup tag instead of RELENG_8_2.

The first thing you need to do is to download the FreeBSD sources for the version RELENG_8_2. One possible way how to do it is using the csup utility. Make sure you have enough free space in the /usr filesystem and download this supfile. You should now edit this file and change the first line

*default host=cvsup.cz.FreeBSD.org

to specify a host name that is near your geographic location. The list of available hosts is here. So after editing, the first line could look like this if you are from France.

*default host=cvsup.fr.FreeBSD.org

Now execute the following command as root:

# csup src-supfile

where the src-supfile is the name of the downloaded supfile. This will download for you the required sources. Wait until the download ends, it will take a while.

Now you need to download the FBFS patch for the FreeBSD kernel. Download it to the /usr/src location. You should apply the patch with the following commands as root:

# cd /usr/src
# patch -p1 < fbfs_midterm.patch

where fbfs_midterm.patch is the name of the downloaded patch file.

The next thing you need to do is to configure your kernel to use the FBFS scheduler. Edit your kernel configuration file. (for example /usr/src/sys/i386/conf/GENERIC) Now locate this line:

options SCHED_ULE # ULE scheduler

and change it to this:

options SCHED_FBFS # FBFS scheduler

Now you need to compile and install the patched kernel. For this, you should read this carefully. To build and install the new kernel, you need to issue these commands as root (Replace the GENERIC with the kernel config file name that you use):

# cd /usr/src
# make buildkernel KERNCONF=GENERIC
# make installkernel KERNCONF=GENERIC

Now reboot and try the FBFS scheduler.

14 Responses to Latest patch available

  1. nestor says:

    I’m so sad this is done on releng8.2 when it should be on current9.0

    well… you must’ve got very strong reasons, still… is there anyone able to port it?

    • Rudo Tomori says:

      Hi,
      here in the discussion you can find a patch created by fidaj. But it is not the latest version. In the discussion you can also find why I am doing it on releng8.2. I was afraid that working on cuurrent could cause me some instability and I would not be sure if the error is mine or some other code. But somewhat later when I consider my code a bit stable, I am planning to switch to the current branch – because I have received quite a lot of feedback similar to yours. Just read the discussion there if you have time.

    • fidaj says:

      Here’s my patch for the latest version for CURRENT…
      The kernel boots and runs without crashes …
      But the sound continues to twitch… Including when watching videos…

  2. nestor says:

    hi! I’m hoping some time in the near future we would be able to test your work!

  3. nestor says:

    some say “beware of what you’d desire for, you might end up having it.” or something like that… well … it seems I’ll have to use 8.2 release on this laptop, I just won’t go ubuntu for this ZFS project… not yet…

  4. timp says:

    I just tried to compile it on FreeBSD 8.2 RELEASE i386 and got
    cc -c -O2 -pipe -fno-strict-aliasing -std=c99 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 –param inline-unit-growth=100 –param large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -Werror /usr/src/sys/kern/sched_fbfs.c
    cc1: warnings being treated as errors
    /usr/src/sys/kern/sched_fbfs.c: In function ‘sched_setup’:
    /usr/src/sys/kern/sched_fbfs.c:189: warning: implicit declaration of function ‘smp_topo’
    /usr/src/sys/kern/sched_fbfs.c:189: warning: nested extern declaration of ‘smp_topo’
    /usr/src/sys/kern/sched_fbfs.c:189: warning: assignment makes pointer from integer without a cast
    /usr/src/sys/kern/sched_fbfs.c:193: warning: implicit declaration of function ‘smp_topo_find’
    /usr/src/sys/kern/sched_fbfs.c:193: warning: nested extern declaration of ‘smp_topo_find’
    /usr/src/sys/kern/sched_fbfs.c:193: warning: assignment makes pointer from integer without a cast
    /usr/src/sys/kern/sched_fbfs.c: In function ‘preempt_lastcpu’:
    /usr/src/sys/kern/sched_fbfs.c:625: warning: implicit declaration of function ‘ipi_cpu’
    /usr/src/sys/kern/sched_fbfs.c:625: warning: nested extern declaration of ‘ipi_cpu’
    /usr/src/sys/kern/sched_fbfs.c:625: error: ‘IPI_AST’ undeclared (first use in this function)
    /usr/src/sys/kern/sched_fbfs.c:625: error: (Each undeclared identifier is reported only once
    /usr/src/sys/kern/sched_fbfs.c:625: error: for each function it appears in.)
    /usr/src/sys/kern/sched_fbfs.c: In function ‘sched_add’:
    /usr/src/sys/kern/sched_fbfs.c:744: error: ‘stopped_cpus’ undeclared (first use in this function)
    /usr/src/sys/kern/sched_fbfs.c:744: error: ‘hlt_cpus_mask’ undeclared (first use in this function)
    /usr/src/sys/kern/sched_fbfs.c:745: error: ‘idle_cpus_mask’ undeclared (first use in this function)
    /usr/src/sys/kern/sched_fbfs.c:753: warning: implicit declaration of function ‘ipi_selected’
    /usr/src/sys/kern/sched_fbfs.c:753: warning: nested extern declaration of ‘ipi_selected’
    /usr/src/sys/kern/sched_fbfs.c:753: error: ‘IPI_AST’ undeclared (first use in this function)
    /usr/src/sys/kern/sched_fbfs.c:761: error: dereferencing pointer to incomplete type
    /usr/src/sys/kern/sched_fbfs.c:762: error: dereferencing pointer to incomplete type
    /usr/src/sys/kern/sched_fbfs.c:763: error: dereferencing pointer to incomplete type
    /usr/src/sys/kern/sched_fbfs.c:764: error: dereferencing pointer to incomplete type
    *** Error code 1

    Stop in /usr/obj/usr/src/sys/TIMBSD.
    *** Error code 1

    Stop in /usr/src.
    *** Error code 1

    Stop in /usr/src.

    • Rudo Tomori says:

      Hi,
      hmmm this is interesting. I have checked the patch and it works for me both on amd64 and i386. Could you run the diff on the file /usr/src/sys/kern/sched_fbfs.c and this one? Because the file I link here is what you should get after successfully applying the patch.

      If the files differ, then try applying the patch again. Something like this should do it:

      1. Synchronize again your sources against the RELENG_8_2 cvsup tag.
      2. Remove the /usr/src/sys/kern/sched_fbfs.c file
      3. cd /usr/src
      4. patch -p1 < patch_file.patch

      Does it help ?

      • timp says:

        [root@timbsd /usr/src]# fetch ‘http://www.ms.mff.cuni.cz/~tomor6am/sched_fbfs.c
        sched_fbfs.c 100% of 27 kB 142 kBps
        [root@timbsd /usr/src]# diff -u /usr/src/sys/kern/sched_fbfs.c sched_fbfs.c sched_fbfs.c

        No differences =(
        I’ll try to compile GENERIC kernel

        • Rudo Tomori says:

          hi,
          please post here then if the compilation of generic was successful. I tried today the patch on i386, it was generic. And it worked to me. However, it was only a virtual machine. But I think this should not be an issue…

Leave a Reply