[Pkg-voip-commits] r7354 - in /dahdi-linux/trunk/debian: changelog patches/mmx_auto patches/mmx_fix patches/oslec_kbuild patches/series
tzafrir-guest at alioth.debian.org
tzafrir-guest at alioth.debian.org
Wed Jun 10 13:04:34 UTC 2009
Author: tzafrir-guest
Date: Wed Jun 10 13:04:34 2009
New Revision: 7354
URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=7354
Log:
* Enable MMX optimization on i386 that supports it (x86, not x86_64).
Doubles OSLEC's performance:
- Adds patches mmx_auto and mmx_fix from upstream bug report.
- Fixes patch oslec_kbuild to use it if enabled.
Added:
dahdi-linux/trunk/debian/patches/mmx_auto
dahdi-linux/trunk/debian/patches/mmx_fix
Modified:
dahdi-linux/trunk/debian/changelog
dahdi-linux/trunk/debian/patches/oslec_kbuild
dahdi-linux/trunk/debian/patches/series
Modified: dahdi-linux/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/changelog?rev=7354&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/changelog (original)
+++ dahdi-linux/trunk/debian/changelog Wed Jun 10 13:04:34 2009
@@ -1,8 +1,15 @@
dahdi-linux (1:2.2.0~dfsg~rc5-1) unstable; urgency=low
- * New upstream release
-
- -- Mark Purcell <msp at debian.org> Sun, 31 May 2009 10:18:49 +1000
+ [ Mark Purcell ]
+ * New upstream release
+
+ [ Tzafrir Cohen ]
+ * Enable MMX optimization on i386 that supports it (x86, not x86_64).
+ Doubles OSLEC's performance:
+ - Adds patches mmx_auto and mmx_fix from upstream bug report.
+ - Fixes patch oslec_kbuild to use it if enabled.
+
+ -- Tzafrir Cohen <tzafrir.cohen at xorcom.com> Wed, 10 Jun 2009 15:59:34 +0300
dahdi-linux (1:2.2.0~dfsg~rc4-1) unstable; urgency=low
Added: dahdi-linux/trunk/debian/patches/mmx_auto
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/mmx_auto?rev=7354&op=file
==============================================================================
--- dahdi-linux/trunk/debian/patches/mmx_auto (added)
+++ dahdi-linux/trunk/debian/patches/mmx_auto Wed Jun 10 13:04:34 2009
@@ -1,0 +1,35 @@
+Enable MMX support if safe on the target CPU type (on most i386 systems,
+not on x86_64).
+
+Patch dahdi_mmx_auto.diff from http://bugs.digium.com/view.php?id=13500
+
+Index: drivers/dahdi/Kbuild
+===================================================================
+--- a/drivers/dahdi/Kbuild (revision 6418)
++++ b/drivers/dahdi/Kbuild (working copy)
+@@ -100,3 +100,25 @@ $(obj)/makefw: $(src)/makefw.c
+ $(HOSTCC) -o $@ $^
+
+ clean-files := radfw.h tor2fw.h
++
++# set CONFIG_DAHDI_MMX for a number of CPU types.
++DAHDI_MMX_AUTO=yes
++DAHDI_USE_MMX=
++DAHDI_MMX_WHITELIST_i386 = M586MMX M686 MPENTIUMII MPENTIUMIII MPENTIUMM \
++ MPENTIUM4 MVIAC3_2 MVIAC3_2 MK7 MK8
++
++DAHDI_MMX_WHITELIST_x86_64 =
++
++# A list of configuration variables to test: CONFIG_M686 , etc.
++DAHDI_MMX_CONFIG_VARS := $(DAHDI_MMX_WHITELIST_$(ARCH):%=CONFIG_%)
++
++# expand them:
++DAHDI_MMX_CONFIG_VALS := $(strip $(foreach var,$(DAHDI_MMX_CONFIG_VARS),$(var)) )
++ifneq (,$(DAHDI_MMX_AUTO))
++ ifneq (,$(DAHDI_MMX_CONFIG_VALS))
++ DAHDI_USE_MMX=yes
++ CFLAGS_zaptel-base.o += -DCONFIG_DAHDI_MMX
++ endif
++endif
++
++export DAHDI_USE_MMX
Added: dahdi-linux/trunk/debian/patches/mmx_fix
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/mmx_fix?rev=7354&op=file
==============================================================================
--- dahdi-linux/trunk/debian/patches/mmx_fix (added)
+++ dahdi-linux/trunk/debian/patches/mmx_fix Wed Jun 10 13:04:34 2009
@@ -1,0 +1,113 @@
+safer MMX support for echo canceller
+
+Properly save MMX registers on i386 (but not x86_64)
+
+Upstream issue: http://bugs.digium.com/view.php?id=13500
+
+Index: drivers/dahdi/dahdi-base.c
+===================================================================
+--- a/drivers/dahdi/dahdi-base.c (revision 6648)
++++ b/drivers/dahdi/dahdi-base.c (working copy)
+@@ -296,9 +296,58 @@ static struct dahdi_dialparams global_dialparams =
+ static int dahdi_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit);
+
+ #if defined(CONFIG_DAHDI_MMX) || defined(ECHO_CAN_FP)
++#if (defined(CONFIG_X86) && !defined(CONFIG_X86_64)) || defined(CONFIG_I386)
++struct fpu_save_buf {
++ unsigned long cr0;
++ unsigned long fpu_buf[128];
++};
++
++static DEFINE_PER_CPU(struct fpu_save_buf, fpu_buf);
++
++/** dahdi_kernel_fpu_begin() - Save floating point registers
++ *
++ * This function is similar to kernel_fpu_begin() . However it is
++ * designed to work in an interrupt context. Restoring must be done with
++ * dahdi_kernel_fpu_end().
++ *
++ * Furthermore, the whole code between the call to
++ * dahdi_kernel_fpu_begin() and dahdi_kernel_fpu_end() must reside
++ * inside a spinlock. Otherwise the context might be restored to the
++ * wrong process.
++ *
++ * Current implementation is x86/ia32-specific and will not even build on
++ * x86_64)
++ * */
++static inline void dahdi_kernel_fpu_begin(void)
++{
++ struct fpu_save_buf *buf = &__get_cpu_var(fpu_buf);
++ __asm__ __volatile__ ("movl %%cr0,%0; clts" : "=r" (buf->cr0));
++ __asm__ __volatile__ ("fnsave %0" : "=m" (buf->fpu_buf));
++}
++
++/** dahdi_kernel_fpu_end() - restore floating point context
++ *
++ * Must be used with context saved by dahdi_kernel_fpu_begin(). See its
++ * documentation for further information.
++ */
++static inline void dahdi_kernel_fpu_end(void)
++{
++ struct fpu_save_buf *buf = &__get_cpu_var(fpu_buf);
++ __asm__ __volatile__ ("frstor %0" : "=m" (buf->fpu_buf));
++ __asm__ __volatile__ ("movl %0,%%cr0" : : "r" (buf->cr0));
++}
++
++#else /* We haven't fixed FP context saving/restoring yet */
++/* Very strange things can happen when the context is not properly
++ * restored. OTOH, some people do report success with this. Hence we
++ * so far just issue a warning */
++#warning CONFIG_ZAPTEL_MMX may behave randomely on this platform
+ #define dahdi_kernel_fpu_begin kernel_fpu_begin
++#define dahdi_kernel_fpu_end kernel_fpu_end
+ #endif
+
++#endif
++
+ struct dahdi_timer {
+ int ms; /* Countdown */
+ int pos; /* Position */
+@@ -6664,7 +6713,7 @@ static inline void __dahdi_ec_chunk(struct dahdi_c
+
+ }
+ #if defined(CONFIG_DAHDI_MMX) || defined(ECHO_CAN_FP)
+- kernel_fpu_end();
++ dahdi_kernel_fpu_end();
+ #endif
+ }
+ spin_unlock_irqrestore(&ss->lock, flags);
+@@ -6997,6 +7046,7 @@ static inline void __putbuf_chunk(struct dahdi_cha
+ int res;
+ int left, x;
+
++
+ while(bytes) {
+ #if defined(CONFIG_DAHDI_NET) || defined(CONFIG_DAHDI_PPP)
+ skb = NULL;
+@@ -7558,7 +7608,7 @@ static void __dahdi_transmit_chunk(struct dahdi_ch
+ #endif
+ __dahdi_process_getaudio_chunk(chan, buf);
+ #ifdef CONFIG_DAHDI_MMX
+- kernel_fpu_end();
++ dahdi_kernel_fpu_end();
+ #endif
+ }
+ }
+@@ -7643,7 +7693,7 @@ static void __dahdi_receive_chunk(struct dahdi_cha
+ #endif
+ __dahdi_process_putaudio_chunk(chan, buf);
+ #ifdef CONFIG_DAHDI_MMX
+- kernel_fpu_end();
++ dahdi_kernel_fpu_end();
+ #endif
+ }
+ __dahdi_putbuf_chunk(chan, buf);
+@@ -7865,7 +7915,7 @@ int dahdi_receive(struct dahdi_span *span)
+ }
+ }
+ #ifdef CONFIG_DAHDI_MMX
+- kernel_fpu_end();
++ dahdi_kernel_fpu_end();
+ #endif
+ }
+ /* do all the pseudo/conferenced channel transmits (putbuf's) */
Modified: dahdi-linux/trunk/debian/patches/oslec_kbuild
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/oslec_kbuild?rev=7354&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/patches/oslec_kbuild (original)
+++ dahdi-linux/trunk/debian/patches/oslec_kbuild Wed Jun 10 13:04:34 2009
@@ -3,6 +3,10 @@
--- /dev/null
+++ b/drivers/staging/echo/Kbuild
-@@ -0,0 +1,2 @@
+@@ -0,0 +1,6 @@
++ifdef DAHDI_USE_MMX
++EXTRA_CFLAGSi += USE_MMX
++endif
++
+# An explicit 'obj-m' , unlike the Makefile
+obj-m += echo.o
Modified: dahdi-linux/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-voip/dahdi-linux/trunk/debian/patches/series?rev=7354&op=diff
==============================================================================
--- dahdi-linux/trunk/debian/patches/series (original)
+++ dahdi-linux/trunk/debian/patches/series Wed Jun 10 13:04:34 2009
@@ -10,3 +10,4 @@
oslec_kbuild
no_firmware_download
+mmx_auto
More information about the Pkg-voip-commits
mailing list