Re: [Fwd: Re: [patch] Real-Time Preemption, -RT-2.6.9-mm1-V0.4]

Ingo Molnar
2004-10-29T16:57:37Z

* Ingo Molnar <mingo@elte.hu> wrote:

> ok, next attempt. Please apply this patch and do the changeall-tree
> thing in the sound/ directory. This should in theory switch the ALSA
> ioctls (and only them) to a BKL-less variant.

ok, new version - the previous one was slighly racy. The one below works
better - it boots on my box and simple audio playback (xmms) works.

Ingo

--- linux/sound/core/pcm_native.c.orig2
+++ linux/sound/core/pcm_native.c
@@ -3317,7 +3317,7 @@ static struct file_operations snd_pcm_f_
.open = snd_pcm_open,
.release = snd_pcm_release,
.poll = snd_pcm_playback_poll,
- .ioctl = snd_pcm_playback_ioctl,
+ .ioctl2 = snd_pcm_playback_ioctl,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
};
@@ -3329,7 +3329,7 @@ static struct file_operations snd_pcm_f_
.open = snd_pcm_open,
.release = snd_pcm_release,
.poll = snd_pcm_capture_poll,
- .ioctl = snd_pcm_capture_ioctl,
+ .ioctl2 = snd_pcm_capture_ioctl,
.mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync,
};
--- linux/sound/pci/ali5451/ali5451.c.orig2
+++ linux/sound/pci/ali5451/ali5451.c
@@ -33,6 +33,7 @@
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/moduleparam.h>
+#include <linux/syscalls.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/info.h>
@@ -985,11 +986,11 @@ static void snd_ali_update_ptr(ali_t *co
pvoice = &codec->synth.voices[channel];
runtime = pvoice->substream->runtime;

- udelay(100);
spin_lock(&codec->reg_lock);

if (pvoice->pcm && pvoice->substream) {
/* pcm interrupt */
+ sys_gettimeofday((void *)0, (void *)1); // start the tracer
#ifdef ALI_DEBUG
outb((u8)(pvoice->number), ALI_REG(codec, ALI_GC_CIR));
temp = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
--- linux/fs/ioctl.c.orig2
+++ linux/fs/ioctl.c
@@ -68,6 +68,13 @@ asmlinkage long sys_ioctl(unsigned int f
goto out;
}

+ error = -ENOTTY;
+ if (filp->f_op && filp->f_op->ioctl2) {
+ error = filp->f_op->ioctl2(filp->f_dentry->d_inode, filp, cmd, arg);
+ fput(filp);
+ return error;
+ }
+
lock_kernel();
switch (cmd) {
case FIOCLEX:
@@ -132,7 +139,6 @@ asmlinkage long sys_ioctl(unsigned int f
}
unlock_kernel();
fput(filp);
-
out:
return error;
}
--- linux/include/linux/fs.h.orig2
+++ linux/include/linux/fs.h
@@ -993,6 +993,7 @@ struct file_operations {
int (*check_flags)(int);
int (*dir_notify)(struct file *filp, unsigned long arg);
int (*flock) (struct file *, int, struct file_lock *);
+ int (*ioctl2) (struct inode *, struct file *, unsigned int, unsigned long);
};

struct inode_operations {