OSS 4.0 and recent -CURRENT

OSS specific BSD discussion (FreeBSD/NetBSD/OpenBSD)

Moderators: cesium, dev, kodachi, hannu

OSS 4.0 and recent -CURRENT

Postby woody » Mon May 07, 2007 3:50 pm

the latest -CURRENT have one significant change - function msleep() renamed to _sleep() and now msleep is a macros. So as result osscore module can't be loaded. I implemented function msleep() in osscore.c according to sys/systm.h header (convert macros to function), but system has been unstable. It's panic's with message "spin locks can only use msleep_spin". Changing call from _sleep() to msleep_spin() in my msleep() implementation solve stability problem.

My system is FreeBSD 7-CURRENT amd64.
diff of my and original osscore.c:
Code: Select all
--- osscore.c.orig      Tue Apr  3 20:56:31 2007
+++ osscore.c   Mon May  7 17:35:45 2007
@@ -31,6 +31,12 @@
#include <vm/vm.h>
#include <vm/pmap.h>

+#ifdef msleep
+#undef msleep
+#endif
+
+int msleep(void *chan, struct mtx *mtx, int pri, const char *wmesg, int timo);
+
typedef struct _oss_device_t oss_device_t;
#include "bsddefs.h"

@@ -51,6 +57,11 @@
extern int soundcard_attach (void);
extern int soundcard_detach (void);

+int msleep(void *chan, struct mtx *mtx, int pri, const char *wmesg, int timo)
+{
+  return msleep_spin(chan, mtx, wmesg, timo);
+}
+
void *
memset (void *t, int val, int l)
{
@@ -164,7 +175,7 @@
     }

   intr->irq == bus_setup_intr (osdev->dip, intr->irqres,
-                              INTR_TYPE_AV | INTR_MPSAFE, ossintr, intr,
+                              INTR_TYPE_AV | INTR_MPSAFE, NULL, ossintr, intr,
                               &(intr->cookie));

   nintrs++;
woody
New Member
 
Posts: 3
Joined: Tue Jan 23, 2007 9:02 pm

Postby sven » Wed Jun 20, 2007 7:40 pm

Has anybody tried this with an -CURRENT from june (including this patch)? Got the same panics and haven't got the time to really look into it...
sven
New Member
 
Posts: 7
Joined: Tue Jun 19, 2007 10:35 pm

Postby edhunter » Tue Jun 26, 2007 7:39 pm

i have tried to install oss on freebsd-7-current
i tried from ports - marked as broken for 7
i tried as a package
Code: Select all
Compiling module osscore
Compiling osscore module failed
Warning: Object directory not changed from original /usr/lib/oss/build
cc -O2 -fno-strict-aliasing -pipe -march=prescott  -D_KERNEL -DKLD_MODULE -std=c99 -nostdinc   -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common  -mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -c osscore.c
osscore.c: In function 'oss_register_interrupts':
osscore.c:168: warning: passing argument 4 of 'bus_setup_intr' from incompatible pointer type
osscore.c:168: warning: passing argument 5 of 'bus_setup_intr' from incompatible pointer type
osscore.c:168: error: too few arguments to function 'bus_setup_intr'
*** Error code 1

Stop in /usr/lib/oss/build.
Starting Open Sound System
No /usr/lib/oss/etc/installed_drivers
Please run ossdetect to create it.
pkg_add: install script returned error status


i tried from source too, but on last step (make install) it fails


so far i cant get it working on freebsd 7 current (i386)
edhunter
New Member
 
Posts: 2
Joined: Tue Jun 26, 2007 7:35 pm

Postby sven » Tue Jun 26, 2007 8:23 pm

Hi!
This error is because bus_setup_intr changed a bit - see the last part of the patch. If you apply that part it will compile. BUT: it will fail miserably with a panic if you install it and try osstest for instance. The panic will be "spin locks can only use msleep_spin".
Hmm... and I don't know what the other parts of the patch should do?!? Perhaps I have a block... or not the deeper knowledge of OSS :wink: But somehow I couldn't find where msleep was really used? And that patch doesn't do *anything* to a current -CURRENT! Posted to the developers-mailing-list but haven't got a response yet.
In my opinion it would be nice to have such a great thing as OSS ready and working till the time 7.0 is out. As I stated on the mailing-list: would be glad to help!
sven
New Member
 
Posts: 7
Joined: Tue Jun 19, 2007 10:35 pm

Postby dev » Tue Jun 26, 2007 9:03 pm

sven wrote:Hi!
This error is because bus_setup_intr changed a bit - see the last part of the patch. If you apply that part it will compile. BUT: it will fail miserably with a panic if you install it and try osstest for instance. The panic will be "spin locks can only use msleep_spin".
Hmm... and I don't know what the other parts of the patch should do?!? Perhaps I have a block... or not the deeper knowledge of OSS :wink: But somehow I couldn't find where msleep was really used? And that patch doesn't do *anything* to a current -CURRENT! Posted to the developers-mailing-list but haven't got a response yet.
In my opinion it would be nice to have such a great thing as OSS ready and working till the time 7.0 is out. As I stated on the mailing-list: would be glad to help!


Hi,


The FreeBSD support is broken up into two parts - one that is kernel version independant - that code is at:
oss-4.0/kernel/OS/FreeBSD/


Now the second part that is OS version dependent is in: oss-4.0/setup/FreeBSD/build/oss/osscore.c


on the web it's http://manuals.opensound.com/sources (look under FreeBSD)


So you may have to make fixes for kernel functions in both places.


regards
Dev Mazumdar
dev
Developer
 
Posts: 577
Joined: Fri Sep 12, 2003 6:08 am
Location: Culver City, CA

Postby sven » Tue Jun 26, 2007 9:30 pm

Well.... I am really PUZZLED right now and I don't really know what to do... Sure, I found that directory earlier.... but as I have stated: I'm nor that good in hardware-programming (though I volunteer as a tester): what should I do now? I'm helpless at the moment... and sure I can wait till the next release - but in this case I will fall back to a cheap soundcard using the FreeBSD drivers..
sven
New Member
 
Posts: 7
Joined: Tue Jun 19, 2007 10:35 pm

Postby edhunter » Wed Jun 27, 2007 6:12 am

well :)
i have cheap audigy se (CA0106-DAT) the one from few unsupported by kernel driver, thats why i tried oss, but i guess i'll wait for a while and hold to my onboard realtek audio.
edhunter
New Member
 
Posts: 2
Joined: Tue Jun 26, 2007 7:35 pm

Postby woody » Wed Jun 27, 2007 8:46 am

sven wrote:This error is because bus_setup_intr changed a bit - see the last part of the patch. If you apply that part it will compile. BUT: it will fail miserably with a panic if you install it and try osstest for instance. The panic will be "spin locks can only use msleep_spin".
Hmm... and I don't know what the other parts of the patch should do?!?


Binaries in the package use function msleep, which became macros, so as result compiled kernel module failed to load with a symbol resolution error. First part of the patch remove msleep macros and implement msleep function using msleep_spin. I using this patch for build #1002 and cannot test it for #1003 due to lack of time.
woody
New Member
 
Posts: 3
Joined: Tue Jan 23, 2007 9:02 pm

Postby sven » Thu Jun 28, 2007 7:08 pm

Binaries in the package use function msleep, which became macros, so as result compiled kernel module failed to load with a symbol resolution error. First part of the patch remove msleep macros and implement msleep function using msleep_spin. I using this patch for build #1002 and cannot test it for #1003 due to lack of time.

Well, the first part of the patch isn't valid for an up to date -CURRENT, that's for sure! :) And it's difficult to say if there were changes between #1002 and #1003 since there is no RCS of some sort.... I think I'll wait till 7 comes out and stick to some cheap soundcard till then using the usual FreeBSD drivers.
sven
New Member
 
Posts: 7
Joined: Tue Jun 19, 2007 10:35 pm

Postby sven » Tue Jul 03, 2007 9:30 pm

Banging my head against the desk... the patch should fix it... could those people using -CURRENT please verify or modify?

*** oss-v4.1test0-070624-src-cddl/kernel/OS/FreeBSD/os_freebsd.c 2007-06-24 18:09:04.000000000 +0200
--- oss-v4.1test0-070624-src-cddl-test/kernel/OS/FreeBSD/os_freebsd.c 2007-07-02 23:24:12.000000000 +0200
***************
*** 152,158 ****
return 0;

wq->flags = 0;
! flag = msleep (wq, *mutex, PRIBIO | PCATCH, "oss", ticks);

if (flag == EWOULDBLOCK) /* Timeout */
{
--- 152,158 ----
return 0;

wq->flags = 0;
! flag = msleep_spin (wq, *mutex, "oss", ticks);

if (flag == EWOULDBLOCK) /* Timeout */
{
*** oss-v4.1test0-070624-src-cddl/setup/FreeBSD/oss/build/osscore.c 2007-06-12 14:22:35.000000000 +0200
--- oss-v4.1test0-070624-src-cddl-test/setup/FreeBSD/oss/build/osscore.c 2007-07-02 23:31:38.000000000 +0200
***************
*** 164,170 ****
}

intr->irq == bus_setup_intr (osdev->dip, intr->irqres,
! INTR_TYPE_AV | INTR_MPSAFE, ossintr, intr,
&(intr->cookie));

nintrs++;
--- 164,170 ----
}

intr->irq == bus_setup_intr (osdev->dip, intr->irqres,
! INTR_TYPE_AV | INTR_MPSAFE, NULL, ossintr, intr,
&(intr->cookie));

nintrs++;
[/code][/quote]
sven
New Member
 
Posts: 7
Joined: Tue Jun 19, 2007 10:35 pm

Postby jkim » Thu Jul 12, 2007 8:27 pm

FYI, I have submitted similar patches to FreeBSD port maintainer and it is now committed:

http://docs.freebsd.org/cgi/mid.cgi?200707121840.l6CIed6e086062

I have little more intrusive patch here:

http://people.freebsd.org/~jkim/oss-gpl-4.0-build1003.diff

I did not perform thorough tests but it seems to work for me. Also, it needs more testing with WITNESS and INVARIANTS options and on -STABLE kernel.
jkim
New Member
 
Posts: 3
Joined: Thu Jul 12, 2007 7:16 pm

Postby jkim » Thu Jul 12, 2007 10:32 pm

I have found another bug. Since they added license type in the version string, it started overflowing the buffer. 'Bad things' may happen when version string is copied with ioctl(SNDCTL_SYSINFO). The following patch fixes the problem:
Code: Select all
--- setup/setupdir.sh.orig      2007-06-27 17:13:23.000000000 -0400
+++ setup/setupdir.sh   2007-07-12 17:58:37.000000000 -0400
@@ -95,7 +95,7 @@

touch .depend

-if date -u +%Y%m%d%H%M > build.id.new 2>/dev/null
+if date -u +%y%m%d > build.id.new 2>/dev/null
then
        rm -f build.id
        mv build.id.new build.id


Obviously it changes the version format but we have no choice because we don't want to break API. :-(
jkim
New Member
 
Posts: 3
Joined: Thu Jul 12, 2007 7:16 pm

Postby jkim » Mon Jul 16, 2007 7:07 pm

I have updated the patches against newer ports:

http://people.freebsd.org/~jkim/oss-cddl-4.0-build1004.diff

I have to warn you that some things are purely guess work. Someone from 4Front should take a look at it.
jkim
New Member
 
Posts: 3
Joined: Thu Jul 12, 2007 7:16 pm

Postby sven » Sun Jul 22, 2007 10:34 pm

Sorry, couldn't reply earlier - had some wine-induced problems... ;)
The patch works! I discovered another problem though (with or without the patch applied): try starting something like esd, do something sound-related, stop/kill esd and try to do a soundoff... it always gives me a message that the modules are busy, but apparently no processes use them?!? it is a buildworld on -CURRENT from friday - if you need more input, tell me! I'll try to give feedback ASAP...
sven
New Member
 
Posts: 7
Joined: Tue Jun 19, 2007 10:35 pm

Postby ksym » Mon Jul 23, 2007 1:32 pm

sven wrote:Sorry, couldn't reply earlier - had some wine-induced problems... ;)
The patch works! I discovered another problem though (with or without the patch applied): try starting something like esd, do something sound-related, stop/kill esd and try to do a soundoff... it always gives me a message that the modules are busy, but apparently no processes use them?!? it is a buildworld on -CURRENT from friday - if you need more input, tell me! I'll try to give feedback ASAP...


This problem is also in -STABLE ...

I have an Audigy 2, osscore/sblive/vmix

etc
ksym
New Member
 
Posts: 3
Joined: Tue Jul 17, 2007 5:00 pm


Return to BSD

Who is online

Users browsing this forum: No registered users and 1 guest