···73realtime tasks have explicitly allocated the CPU time they need to perform74their tasks, buffer underruns in the graphics or audio can be eliminated.7576-NOTE: the above example is not fully implemented as of yet (2.6.25). We still77lack an EDF scheduler to make non-uniform periods usable.7879···140141.o CONFIG_CGROUP_SCHED (aka "Basis for grouping tasks" = "Control groups")142143-This uses the /cgroup virtual file system and "/cgroup/<cgroup>/cpu.rt_runtime_us"144-to control the CPU time reserved for each control group instead.0145146For more information on working with control groups, you should read147Documentation/cgroups/cgroups.txt as well.148149-Group settings are checked against the following limits in order to keep the configuration150-schedulable:151152 \Sum_{i} runtime_{i} / global_period <= global_runtime / global_period153···190the biggest challenge as the current linux PI infrastructure is geared towards191the limited static priority levels 0-99. With deadline scheduling you need to192do deadline inheritance (since priority is inversely proportional to the193-deadline delta (deadline - now).194195This means the whole PI machinery will have to be reworked - and that is one of196the most complex pieces of code we have.
···73realtime tasks have explicitly allocated the CPU time they need to perform74their tasks, buffer underruns in the graphics or audio can be eliminated.7576+NOTE: the above example is not fully implemented yet. We still77lack an EDF scheduler to make non-uniform periods usable.7879···140141.o CONFIG_CGROUP_SCHED (aka "Basis for grouping tasks" = "Control groups")142143+This uses the /cgroup virtual file system and144+"/cgroup/<cgroup>/cpu.rt_runtime_us" to control the CPU time reserved for each145+control group instead.146147For more information on working with control groups, you should read148Documentation/cgroups/cgroups.txt as well.149150+Group settings are checked against the following limits in order to keep the151+configuration schedulable:152153 \Sum_{i} runtime_{i} / global_period <= global_runtime / global_period154···189the biggest challenge as the current linux PI infrastructure is geared towards190the limited static priority levels 0-99. With deadline scheduling you need to191do deadline inheritance (since priority is inversely proportional to the192+deadline delta (deadline - now)).193194This means the whole PI machinery will have to be reworked - and that is one of195the most complex pieces of code we have.
···30#include <asm/hw_irq.h>31#include <asm/kvm_para.h>3233-/*G:031 But first, how does our Guest contact the Host to ask for privileged34 * operations? There are two ways: the direct way is to make a "hypercall",35 * to make requests of the Host Itself.36 *
···30#include <asm/hw_irq.h>31#include <asm/kvm_para.h>3233+/*G:030 But first, how does our Guest contact the Host to ask for privileged34 * operations? There are two ways: the direct way is to make a "hypercall",35 * to make requests of the Host Itself.36 *
+3-11
arch/x86/kernel/apic/io_apic.c
···4181 }4182}41834184-static int __init ioapic_insert_resources(void)4185{4186 int i;4187 struct resource *r = ioapic_resources;41884189 if (!r) {4190- if (nr_ioapics > 0) {4191 printk(KERN_ERR4192 "IO APIC resources couldn't be allocated.\n");4193- return -1;4194- }4195- return 0;4196 }41974198 for (i = 0; i < nr_ioapics; i++) {4199 insert_resource(&iomem_resource, r);4200 r++;4201 }4202-4203- return 0;4204}4205-4206-/* Insert the IO APIC resources after PCI initialization has occured to handle4207- * IO APICS that are mapped in on a BAR in PCI space. */4208-late_initcall(ioapic_insert_resources);
···4181 }4182}41834184+void __init ioapic_insert_resources(void)4185{4186 int i;4187 struct resource *r = ioapic_resources;41884189 if (!r) {4190+ if (nr_ioapics > 0)4191 printk(KERN_ERR4192 "IO APIC resources couldn't be allocated.\n");4193+ return;004194 }41954196 for (i = 0; i < nr_ioapics; i++) {4197 insert_resource(&iomem_resource, r);4198 r++;4199 }004200}0000
+6-1
arch/x86/lguest/boot.c
···379380 native_cpuid(ax, bx, cx, dx);381 switch (function) {00000382 case 1: /* Basic feature request. */383 /* We only allow kernel to see SSE3, CMPXCHG16B and SSSE3 */384 *cx &= 0x00002201;···1084 return insn_len;1085}10861087-/*G:030 Once we get to lguest_init(), we know we're a Guest. The various1088 * pv_ops structures in the kernel provide points for (almost) every routine we1089 * have to override to avoid privileged instructions. */1090__init void lguest_init(void)
···379380 native_cpuid(ax, bx, cx, dx);381 switch (function) {382+ case 0: /* ID and highest CPUID. Futureproof a little by sticking to383+ * older ones. */384+ if (*ax > 5)385+ *ax = 5;386+ break;387 case 1: /* Basic feature request. */388 /* We only allow kernel to see SSE3, CMPXCHG16B and SSSE3 */389 *cx &= 0x00002201;···1079 return insn_len;1080}10811082+/*G:029 Once we get to lguest_init(), we know we're a Guest. The various1083 * pv_ops structures in the kernel provide points for (almost) every routine we1084 * have to override to avoid privileged instructions. */1085__init void lguest_init(void)
···35#include <asm/pat.h>36#include <asm/e820.h>37#include <asm/pci_x86.h>38+#include <asm/io_apic.h>394041static int···227 pcibios_allocate_resources(1);228229 e820_reserve_resources_late();230+ /*231+ * Insert the IO APIC resources after PCI initialization has232+ * occured to handle IO APICS that are mapped in on a BAR in233+ * PCI space, but before trying to assign unassigned pci res.234+ */235+ ioapic_insert_resources();236}237238/**
+4-1
drivers/block/virtio_blk.c
···213 * Only allow the generic SCSI ioctls if the host can support it.214 */215 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))216- return -ENOIOCTLCMD;217218 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);219}···359 /* We can handle whatever the host told us to handle. */360 blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2);361 blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2);000362363 /* No real sector limit. */364 blk_queue_max_sectors(vblk->disk->queue, -1U);
···213 * Only allow the generic SCSI ioctls if the host can support it.214 */215 if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))216+ return -ENOTTY;217218 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);219}···359 /* We can handle whatever the host told us to handle. */360 blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2);361 blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2);362+363+ /* No need to bounce any requests */364+ blk_queue_bounce_limit(vblk->disk->queue, BLK_BOUNCE_ANY);365366 /* No real sector limit. */367 blk_queue_max_sectors(vblk->disk->queue, -1U);
-3
drivers/char/n_tty.c
···13311332static void n_tty_write_wakeup(struct tty_struct *tty)1333{1334- /* Write out any echoed characters that are still pending */1335- process_echoes(tty);1336-1337 if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags))1338 kill_fasync(&tty->fasync, SIGIO, POLL_OUT);1339}
···828 struct port *port = &dc->port[index];829 void __iomem *addr = port->dl_addr[port->toggle_dl];830 struct tty_struct *tty = tty_port_tty_get(&port->port);831- int i;832833 if (unlikely(!tty)) {834 DBG1("tty not open for port: %d?", index);···844845 /* disable interrupt in downlink... */846 disable_transmit_dl(index, dc);847- return 0;0848 }849850 if (unlikely(size == 0)) {851 dev_err(&dc->pdev->dev, "size == 0?\n");852- return 1;0853 }854855 tty_buffer_request_room(tty, size);···873 }874875 set_bit(index, &dc->flip);00876 tty_kref_put(tty);877- return 1;878}879880/* Debug for interrupts */
···828 struct port *port = &dc->port[index];829 void __iomem *addr = port->dl_addr[port->toggle_dl];830 struct tty_struct *tty = tty_port_tty_get(&port->port);831+ int i, ret;832833 if (unlikely(!tty)) {834 DBG1("tty not open for port: %d?", index);···844845 /* disable interrupt in downlink... */846 disable_transmit_dl(index, dc);847+ ret = 0;848+ goto put;849 }850851 if (unlikely(size == 0)) {852 dev_err(&dc->pdev->dev, "size == 0?\n");853+ ret = 1;854+ goto put;855 }856857 tty_buffer_request_room(tty, size);···871 }872873 set_bit(index, &dc->flip);874+ ret = 1;875+put:876 tty_kref_put(tty);877+ return ret;878}879880/* Debug for interrupts */
+15-10
drivers/char/tty_ldisc.c
···790 * N_TTY.791 */792 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {793- /* Avoid racing set_ldisc */794 mutex_lock(&tty->ldisc_mutex);795- /* Switch back to N_TTY */796- tty_ldisc_halt(tty);797- tty_ldisc_wait_idle(tty);798- tty_ldisc_reinit(tty);799- /* At this point we have a closed ldisc and we want to800- reopen it. We could defer this to the next open but801- it means auditing a lot of other paths so this is a FIXME */802- WARN_ON(tty_ldisc_open(tty, tty->ldisc));803- tty_ldisc_enable(tty);000804 mutex_unlock(&tty->ldisc_mutex);805 tty_reset_termios(tty);806 }···868869 tty_ldisc_wait_idle(tty);8700871 /*872 * Now kill off the ldisc873 */···879880 /* Ensure the next open requests the N_TTY ldisc */881 tty_set_termios_ldisc(tty, N_TTY);0882883 /* This will need doing differently if we need to lock */884 if (o_tty)
···790 * N_TTY.791 */792 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {793+ /* Avoid racing set_ldisc or tty_ldisc_release */794 mutex_lock(&tty->ldisc_mutex);795+ if (tty->ldisc) { /* Not yet closed */796+ /* Switch back to N_TTY */797+ tty_ldisc_halt(tty);798+ tty_ldisc_wait_idle(tty);799+ tty_ldisc_reinit(tty);800+ /* At this point we have a closed ldisc and we want to801+ reopen it. We could defer this to the next open but802+ it means auditing a lot of other paths so this is803+ a FIXME */804+ WARN_ON(tty_ldisc_open(tty, tty->ldisc));805+ tty_ldisc_enable(tty);806+ }807 mutex_unlock(&tty->ldisc_mutex);808 tty_reset_termios(tty);809 }···865866 tty_ldisc_wait_idle(tty);867868+ mutex_lock(&tty->ldisc_mutex);869 /*870 * Now kill off the ldisc871 */···875876 /* Ensure the next open requests the N_TTY ldisc */877 tty_set_termios_ldisc(tty, N_TTY);878+ mutex_unlock(&tty->ldisc_mutex);879880 /* This will need doing differently if we need to lock */881 if (o_tty)
···11#define LG_CLOCK_MIN_DELTA 100UL12#define LG_CLOCK_MAX_DELTA ULONG_MAX1314-/*G:032 The second method of communicating with the Host is to via "struct15 * lguest_data". Once the Guest's initialization hypercall tells the Host where16 * this is, the Guest and Host both publish information in it. :*/17struct lguest_data
···11#define LG_CLOCK_MIN_DELTA 100UL12#define LG_CLOCK_MAX_DELTA ULONG_MAX1314+/*G:031 The second method of communicating with the Host is to via "struct15 * lguest_data". Once the Guest's initialization hypercall tells the Host where16 * this is, the Guest and Host both publish information in it. :*/17struct lguest_data
+10-4
include/linux/virtio_net.h
···27#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */28#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */29#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */03031#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */32···82#define VIRTIO_NET_ERR 18384/*85- * Control the RX mode, ie. promisucous and allmulti. PROMISC and86- * ALLMULTI commands require an "out" sg entry containing a 1 byte87- * state value, zero = disable, non-zero = enable. These commands88- * are supported with the VIRTIO_NET_F_CTRL_RX feature.089 */90#define VIRTIO_NET_CTRL_RX 091 #define VIRTIO_NET_CTRL_RX_PROMISC 092 #define VIRTIO_NET_CTRL_RX_ALLMULTI 100009394/*95 * Control the MAC filter table.
···27#define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */28#define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */29#define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */30+#define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */3132#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */33···81#define VIRTIO_NET_ERR 18283/*84+ * Control the RX mode, ie. promisucous, allmulti, etc...85+ * All commands require an "out" sg entry containing a 1 byte86+ * state value, zero = disable, non-zero = enable. Commands87+ * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature.88+ * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA.89 */90#define VIRTIO_NET_CTRL_RX 091 #define VIRTIO_NET_CTRL_RX_PROMISC 092 #define VIRTIO_NET_CTRL_RX_ALLMULTI 193+ #define VIRTIO_NET_CTRL_RX_ALLUNI 294+ #define VIRTIO_NET_CTRL_RX_NOMULTI 395+ #define VIRTIO_NET_CTRL_RX_NOUNI 496+ #define VIRTIO_NET_CTRL_RX_NOBCAST 59798/*99 * Control the MAC filter table.
···687 * all of which have the same weight.688 */689 if (sched_feat(NORMALIZED_SLEEPER) &&690- task_of(se)->policy != SCHED_IDLE)0691 thresh = calc_delta_fair(thresh, se);692693 vruntime -= thresh;
···687 * all of which have the same weight.688 */689 if (sched_feat(NORMALIZED_SLEEPER) &&690+ (!entity_is_task(se) ||691+ task_of(se)->policy != SCHED_IDLE))692 thresh = calc_delta_fair(thresh, se);693694 vruntime -= thresh;