Re: 2.6.20-rt8 patch tweaked for 2.6.20.5
Ingo Molnar wrote: John wrote: Great! Can you tell me how you generate the original -rt patch, so I can provide an updated version when a new 2.6.20 kernel is released? they should be generated the way you did: apply the 2.6.20 baseline -rt kernel patch to the later patches and fix up rejects. For later kernels just do the same. What options do you give diff? The output of your patch is e.g. Index: linux/drivers/input/gameport/gameport.c === --- linux.orig/drivers/input/gameport/gameport.c +++ linux/drivers/input/gameport/gameport.c @@ -21,6 +21,7 @@ #include #include #include +#include [...] diff -upr gives me, e.g. diff -upr linux-2.6.20.5/drivers/input/gameport/gameport.c linux-2.6.20.5-rt8/drivers/input/gameport/gameport.c --- linux-2.6.20.5/drivers/input/gameport/gameport.c2007-04-06 12:44:59.0 +0200 +++ linux-2.6.20.5-rt8/drivers/input/gameport/gameport.c 2007-04-06 18:09:48.0 +0200 @@ -21,6 +21,7 @@ #include #include #include +#include [...] How do I get diff not to print the file time stamps? How do I get diff not to print the command line for each file? Regards. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.20-rt8 patch tweaked for 2.6.20.5
* John <[EMAIL PROTECTED]> wrote: > > sure, i can put it there. > > Great! Can you tell me how you generate the original -rt patch, so I > can provide an updated version when a new 2.6.20 kernel is released? they should be generated the way you did: apply the 2.6.20 baseline -rt kernel patch to the later patches and fix up rejects. For later kernels just do the same. > If I understand correctly, removing that specific patch from > patch-2.6.20-rt8 is the appropriate course of action then? yes. Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.20-rt8 patch tweaked for 2.6.20.5
Ingo Molnar wrote: John wrote: I'd be happy to generate a clean patch! (Would you agree to host it in your directory?) http://people.redhat.com/mingo/realtime-preempt/older/ sure, i can put it there. Great! Can you tell me how you generate the original -rt patch, so I can provide an updated version when a new 2.6.20 kernel is released? 3. linux/kernel/futex.c [ I'm not sure I've made the appropriate changes here ] Basically, we want to replace spin_lock(&pi_state->pi_mutex.wait_lock); with spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); and we want to replace spin_unlock(&pi_state->pi_mutex.wait_lock); with spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); Is that correct? yes. OK. 5. linux/net/xfrm/xfrm_user.c [ I'm not sure I've made the appropriate changes here ] Remove a patch that was already applied to 2.6.20.2 cf. patch-2.6.20.2 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1273,10 +1273,6 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, delete); security_xfrm_policy_free(&tmp); } - if (delete) - xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, - AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL); - if (xp == NULL) return -ENOENT; @@ -1292,8 +1288,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, MSG_DONTWAIT); } } else { - if ((err = security_xfrm_policy_delete(xp)) != 0) + err = security_xfrm_policy_delete(xp); + + xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, + AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL); + + if (err != 0) goto out; + c.data.byid = p->index; c.event = nlh->nlmsg_type; c.seq = nlh->nlmsg_seq; As a side note, I find the expression err ? 0 : 1 suspect. Why not write !err ? it was in the original code and i didn't want to change that. I've attached the original patch below - the bug is probably fixed upstream meanwhile (in a different way) so no need to do any change there. If I understand correctly, removing that specific patch from patch-2.6.20-rt8 is the appropriate course of action then? Regards. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.20-rt8 patch tweaked for 2.6.20.5
* John <[EMAIL PROTECTED]> wrote: > I'd be happy to generate a clean patch! > (Would you agree to host it in your directory?) > http://people.redhat.com/mingo/realtime-preempt/older/ sure, i can put it there. > 3. linux/kernel/futex.c > [ I'm not sure I've made the appropriate changes here ] > > Basically, we want to replace > spin_lock(&pi_state->pi_mutex.wait_lock); > with > spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); > > and we want to replace > spin_unlock(&pi_state->pi_mutex.wait_lock); > with > spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); > > Is that correct? yes. > 4. linux/kernel/time/clocksource.c > Provide an #include directive added by patch-2.6.20.2 > Remove the first line to keep patch happy. > > --- a/kernel/time/clocksource.c > +++ b/kernel/time/clocksource.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include /* for spin_unlock_irq() using preempt_count() > m68k */ > > /* XXX - Would like a better way for initializing curr_clocksource */ > extern struct clocksource clocksource_jiffies; > > > 5. linux/net/xfrm/xfrm_user.c > [ I'm not sure I've made the appropriate changes here ] > > Remove a patch that was already applied to 2.6.20.2 > cf. patch-2.6.20.2 > > --- a/net/xfrm/xfrm_user.c > +++ b/net/xfrm/xfrm_user.c > @@ -1273,10 +1273,6 @@ static int xfrm_get_policy(struct sk_buff *skb, > struct nlmsghdr *nlh, > xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, > tmp.security, delete); > security_xfrm_policy_free(&tmp); > } > - if (delete) > - xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, > -AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, > NULL); > - > if (xp == NULL) > return -ENOENT; > > @@ -1292,8 +1288,14 @@ static int xfrm_get_policy(struct sk_buff *skb, > struct nlmsghdr *nlh, > MSG_DONTWAIT); > } > } else { > - if ((err = security_xfrm_policy_delete(xp)) != 0) > + err = security_xfrm_policy_delete(xp); > + > + xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, > +AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, > NULL); > + > + if (err != 0) > goto out; > + > c.data.byid = p->index; > c.event = nlh->nlmsg_type; > c.seq = nlh->nlmsg_seq; > > > As a side note, I find the expression > err ? 0 : 1 > suspect. Why not write !err ? it was in the original code and i didnt want to change that. I've attached the original patch below - the bug is probably fixed upstream meawhile (in a different way) so no need to do any change there. Ingo ---> Subject: [patch] net/xfrm: fix audit logging From: Ingo Molnar <[EMAIL PROTECTED]> i got the following crash when restarting a (timed out) ipsec session on 2.6.20-rc1: BUG: unable to handle kernel NULL pointer dereference at virtual address 00a2 printing eip: c0320f67 *pde = stopped custom tracer. Oops: [#1] PREEMPT SMP Modules linked in: xfrm4_mode_tunnel deflate zlib_deflate twofish twofish_common serpent blowfish cbc ecb xcbc sha256 crypto_null aes des blkcipher xfrm4_tunnel tunnel4 ipcomp esp4 ah4 af_key radeon drm hidp l2cap bluetooth sunrpc ipv6 n_hdlc ppp_synctty ppp_async crc_ccitt ppp_generic slhc nf_conntrack_netbios_ns ipt_REJECT nf_conntrack_ipv4 xt_state xt_tcpudp iptable_filter ip_tables x_tables dm_mirror dm_multipath dm_mod raid1 video sbs i2c_ec button battery asus_acpi ac parport_pc lp parport floppy snd_via82xx_modem snd_seq_dummy snd_via82xx snd_ac97_codec snd_seq_oss snd_seq_midi_event ac97_bus bt878 tuner snd_seq bttv video_buf ir_common snd_pcm_oss snd_mixer_oss videodev v4l1_compat v4l2_common i2c_algo_bit snd_pcm btcx_risc tveeprom compat_ioctl32 pcspkr e100 skge mii i2c_viapro snd_timer gameport snd_mpu401_uart snd_rawmidi snd_seq_device snd_page_alloc snd i2c_core soundcore k8temp hwmon ide_cd serio_raw cdrom sata_via pata_via ata_generic libata sd_mod scsi_mod ext3 jbd ehci_hcd ohci_hcd uhci_hcd CPU:0 EIP:0060:[]Not tainted VLI EFLAGS: 00010246 (2.6.20-rc1.1.rt4.0006 #1) EIP is at xfrm_audit_log+0x116/0x423 eax: ebx: 0586 ecx: edx: c03dfc79 esi: 01f4 edi: ebp: f5229a48 esp: f522999c ds: 007b es: 007b ss: 0068 preempt: 0001 Process pluto (pid: 12885, ti=f5229000 task=f7c06af0 task.ti=f5229000) Stack: f7c5be00 c03f6e49 01f4 f3860a80 f52299bc c02ca13f f52299dc c02ca247 0006 f52299e4 c01254ba 0001 e86fd000 f52299e4 c02ca27d f7c5be00 f8d928b9 f5229a10 c0155d14 f3860a80 fffd Call Trace: [] xfrm_get_policy+0x108/0x24f [] xfrm_user_rcv_msg+0x132/0x155 [] netlink_run_queue+0x61/0xcd [] xfrm_netlink_rcv+0x27/0x3b [] netlink_data_ready+0x13
Re: 2.6.20-rt8 patch tweaked for 2.6.20.5
Ingo Molnar wrote: John wrote: I've tweaked patch-2.6.20-rt8 so that it applies to 2.6.20.5 The unified diff is attached to this message. thanks - this is useful to those who are not that much on the bleeding edge. I'd be happy to hear comments on what I've done wrong. 78 hunks had to be offset and 3 hunks had to be fuzzed. $ grep -B1 fuzz patch.log patching file arch/ia64/kernel/iosapic.c Hunk #3 succeeded at 469 with fuzz 2. -- patching file kernel/fork.c Hunk #9 succeeded at 975 with fuzz 1. -- patching file kernel/sched.c Hunk #46 succeeded at 3996 with fuzz 1. What is the fuzz value, exactly? it's harmless: when the 'patch' utility didn't find the 'context' of the patch chunk at its claimed position (because all patch chunks have precise coordinates of source code embedded), but finds them 'nearby' (or at least, somewhere in the file), it emits this reminder that the underlying code did change since the patch was generated. Generating a 'clean' patch will get rid of these messages. Ingo, I'd be happy to generate a clean patch! (Would you agree to host it in your directory?) http://people.redhat.com/mingo/realtime-preempt/older/ What options did you run diff with to generate the original patch? diff -upr ? How do you prevent diff from printing timestamps? Could you, or Thomas, or someone else, take a look at my patch, and tell me if everything looks right before I go ahead? I've documented all the changes below: 1. linux/Makefile (trivial) Tweak EXTRAVERSION to change .5 into .5-rt8 2. linux/drivers/kvm/kvm.h Remove a patch that was already applied to 2.6.20.2 cf. patch-2.6.20.2 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h @@ -558,7 +558,7 @@ static inline void load_gs(u16 sel) #ifndef load_ldt static inline void load_ldt(u16 sel) { - asm ("lldt %0" : : "g"(sel)); + asm ("lldt %0" : : "rm"(sel)); } #endif 3. linux/kernel/futex.c [ I'm not sure I've made the appropriate changes here ] Basically, we want to replace spin_lock(&pi_state->pi_mutex.wait_lock); with spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); and we want to replace spin_unlock(&pi_state->pi_mutex.wait_lock); with spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); Is that correct? 4. linux/kernel/time/clocksource.c Provide an #include directive added by patch-2.6.20.2 Remove the first line to keep patch happy. --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -28,6 +28,7 @@ #include #include #include +#include /* for spin_unlock_irq() using preempt_count() m68k */ /* XXX - Would like a better way for initializing curr_clocksource */ extern struct clocksource clocksource_jiffies; 5. linux/net/xfrm/xfrm_user.c [ I'm not sure I've made the appropriate changes here ] Remove a patch that was already applied to 2.6.20.2 cf. patch-2.6.20.2 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1273,10 +1273,6 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, delete); security_xfrm_policy_free(&tmp); } - if (delete) - xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, - AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL); - if (xp == NULL) return -ENOENT; @@ -1292,8 +1288,14 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, MSG_DONTWAIT); } } else { - if ((err = security_xfrm_policy_delete(xp)) != 0) + err = security_xfrm_policy_delete(xp); + + xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, + AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL); + + if (err != 0) goto out; + c.data.byid = p->index; c.event = nlh->nlmsg_type; c.seq = nlh->nlmsg_seq; As a side note, I find the expression err ? 0 : 1 suspect. Why not write !err ? Regards. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: 2.6.20-rt8 patch tweaked for 2.6.20.5
* John <[EMAIL PROTECTED]> wrote: > Hello, > > I've tweaked patch-2.6.20-rt8 so that it applies to 2.6.20.5 > > The unified diff is attached to this message. thanks - this is useful to those who are not that much on the bleeding edge. > I'd be happy to hear comments on what I've done wrong. > > 78 hunks had to be offset and 3 hunks had to be fuzzed. > > $ grep -B1 fuzz patch.log > patching file arch/ia64/kernel/iosapic.c > Hunk #3 succeeded at 469 with fuzz 2. > -- > patching file kernel/fork.c > Hunk #9 succeeded at 975 with fuzz 1. > -- > patching file kernel/sched.c > Hunk #46 succeeded at 3996 with fuzz 1. > > What is the fuzz value, exactly? it's harmless: when the 'patch' utility didnt find the 'context' of the patch chunk at its claimed position (because all patch chunks have precise coordinates of source code embedded), but finds them 'nearby' (or at least, somewhere in the file), it emits this reminder that the underlying code did change since the patch was generated. Generating a 'clean' patch will get rid of these messages. Ingo - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
2.6.20-rt8 patch tweaked for 2.6.20.5
Hello, I've tweaked patch-2.6.20-rt8 so that it applies to 2.6.20.5 The unified diff is attached to this message. I'd be happy to hear comments on what I've done wrong. 78 hunks had to be offset and 3 hunks had to be fuzzed. $ grep -B1 fuzz patch.log patching file arch/ia64/kernel/iosapic.c Hunk #3 succeeded at 469 with fuzz 2. -- patching file kernel/fork.c Hunk #9 succeeded at 975 with fuzz 1. -- patching file kernel/sched.c Hunk #46 succeeded at 3996 with fuzz 1. What is the fuzz value, exactly? Regards. --- patch-2.6.20-rt82007-02-16 10:48:03.0 +0100 +++ patch-2.6.20.5-rt8 2007-04-06 17:55:30.0 +0200 @@ -770,8 +770,8 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 20 --EXTRAVERSION = -+EXTRAVERSION = -rt8 +-EXTRAVERSION = .5 ++EXTRAVERSION = .5-rt8 NAME = Homicidal Dwarf Hamster # *DOCUMENTATION* @@ -19927,15 +19927,6 @@ unsigned long segment_base(u16 selector); void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes); -@@ -558,7 +587,7 @@ static inline void load_gs(u16 sel) - #ifndef load_ldt - static inline void load_ldt(u16 sel) - { -- asm ("lldt %0" : : "g"(sel)); -+ asm ("lldt %0" : : "rm"(sel)); - } - #endif - @@ -627,4 +656,6 @@ static inline u32 get_rdx_init_val(void) #define TSS_REDIRECTION_SIZE (256 / 8) #define RMODE_TSS_SIZE (TSS_BASE_SIZE + TSS_REDIRECTION_SIZE + TSS_IOPB_SIZE + 1) @@ -38197,7 +38188,7 @@ if (q->filp) send_sigio(&q->filp->f_owner, q->fd, POLL_IN); /* -@@ -561,10 +608,12 @@ static int wake_futex_pi(u32 __user *uad +@@ -561,11 +608,12 @@ static int wake_futex_pi(u32 __user *uad struct task_struct *new_owner; struct futex_pi_state *pi_state = this->pi_state; u32 curval, newval; @@ -38206,11 +38197,12 @@ if (!pi_state) return -EINVAL; +- spin_lock(&pi_state->pi_mutex.wait_lock); + spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); new_owner = rt_mutex_next_owner(&pi_state->pi_mutex); /* -@@ -583,27 +632,40 @@ static int wake_futex_pi(u32 __user *uad +@@ -583,28 +632,40 @@ static int wake_futex_pi(u32 __user *uad */ if (!(uval & FUTEX_OWNER_DIED)) { newval = FUTEX_WAITERS | new_owner->pid; @@ -38253,6 +38245,7 @@ - spin_unlock_irq(&new_owner->pi_lock); + spin_unlock(&new_owner->pi_lock); +- spin_unlock(&pi_state->pi_mutex.wait_lock); + spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); rt_mutex_unlock(&pi_state->pi_mutex); @@ -54910,9 +54903,9 @@ --- linux.orig/kernel/time/clocksource.c +++ linux/kernel/time/clocksource.c @@ -28,6 +28,7 @@ - #include #include #include + #include /* for spin_unlock_irq() using preempt_count() m68k */ +#include /* XXX - Would like a better way for initializing curr_clocksource */ @@ -66089,27 +66082,6 @@ } /* When dgram socket disconnects (or changes its peer), we clear its receive -Index: linux/net/xfrm/xfrm_user.c -=== linux.orig/net/xfrm/xfrm_user.c -+++ linux/net/xfrm/xfrm_user.c -@@ -1273,13 +1273,12 @@ static int xfrm_get_policy(struct sk_buf - xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, tmp.security, delete); - security_xfrm_policy_free(&tmp); - } -- if (delete) -- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, -- AUDIT_MAC_IPSEC_DELSPD, (xp) ? 1 : 0, xp, NULL); -- - if (xp == NULL) - return -ENOENT; - -+ xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid, -+ AUDIT_MAC_IPSEC_DELSPD, delete, xp, NULL); -+ - if (!delete) { - struct sk_buff *resp_skb; - Index: linux/scripts/Makefile === --- linux.orig/scripts/Makefile patching file Documentation/feature-removal-schedule.txt patching file Documentation/hrtimer/timer_stats.txt patching file Documentation/hrtimers.txt patching file Documentation/hrtimers/highres.txt patching file Documentation/hrtimers/hrtimers.txt patching file Documentation/kernel-parameters.txt patching file Documentation/stable_api_nonsense.txt patching file Makefile patching file arch/arm/Kconfig patching file arch/arm/boot/compressed/head.S patching file arch/arm/common/time-acorn.c patching file arch/arm/kernel/dma.c patching file arch/arm/kernel/entry-armv.S patching file arch/arm/kernel/entry-common.S patching file arch/arm/kernel/fiq.c patching file arch/arm/kernel/irq.c patching file arch/arm/kernel/process.c patching file arch/arm/kernel/semaphore.c patching file arch/arm/kernel/signal.c patching file arch/arm/kernel/smp.c patching file arch/arm/kernel/time.c patching file arch/arm/kernel/traps.c patching file arch/arm/mach-footbridge/netwinder-hw.c patching file arch/arm/mach-footbridge/netwinder-leds.c patching fi