Re: Can vm_mmap()/vm_map_remove() be called with giant held? (linuxolator dvb patches)

2011-01-30 Thread Kostik Belousov
On Sun, Jan 30, 2011 at 12:54:48AM +0100, Juergen Lock wrote:
 On Sat, Jan 29, 2011 at 10:51:05PM +0200, Kostik Belousov wrote:
  On Sat, Jan 29, 2011 at 09:10:00PM +0100, Juergen Lock wrote:
   Hi!
   
I was kinda hoping to be able to post a correct patch in public but
   getting an answer to ${Subject} seems to be more difficult than I
   thought... :)  So, does anyone here know?  copyout_map() and
  You do not need Giant locked for vm_map* functions.
  
 The question was more do I need to drop it first before calling them...
No, you do not need to drop Giant.

[snip]
   + error = ENOMEM;
   + goto out2;
   + }
   + error = copyin((void *) vps.props, l_vp, l_propsiz);
   + if (error)
   + goto out2;
   + for (i = vps.num, l_p = l_vp, p = vp; i--; ++l_p, ++p)
   + linux_to_bsd_dtv_property(l_p, p);
   +
   + error = copyout_map(td, uvp, propsiz);
   + if (error)
   + goto out2;
   + copyout(vp, (void *) uvp, propsiz);
   +
   + if ((error = fget(td, args-fd, fp)) != 0) {
   + (void) copyout_unmap(td, uvp, propsiz);
   + goto out2;
   + }
   + vps.props = (void *) uvp;
   + if ((args-cmd  0x) == LINUX_FE_SET_PROPERTY)
   + error = fo_ioctl(fp, FE_SET_PROPERTY, vps, 
   td-td_ucred, td);
   + else
   + error = fo_ioctl(fp, FE_GET_PROPERTY, vps, 
   td-td_ucred, td);
   + if (error) {
   + (void) copyout_unmap(td, uvp, propsiz);
   + goto out;
   + }
   + error = copyin((void *) uvp, vp, propsiz);
   + (void) copyout_unmap(td, uvp, propsiz);
  No need in space between cast and expression. Bigger issue is that I
  do not understand this fragment. You do copyout_map(), and then
  immediately call copyout_unmap() for the address range returned
  by copyout_map(), or am I missing something ?
  
  The vm allocated by copyout_map() is only needed for the fo_ioctl()
 call because the struct passed to FE_[GS]ET_PROPERTY describes an
 array that the drivers then copyin() and (possibly) copyout()
 themselves.  So that array needs to be translated from/to the 32bit
 Linux version to (possibly) 64bit on the host (linux_to_bsd_dtv_property),
 and the 64bit version is larger so it doesn't fit in the original
 place in the userland vm.
And am I right that the drivers can only take this array from the usermode ?
How is the compatibility for 32/64 bit mode is handled by native
FE_SET_PROPERTY handlers ?

I could only say that the hack is atrocious. Might be, you indeed have
no choice there.
 
  (One optimization here would be to only do this when the sizes
 differ i.e. in the 32bit-on-64 case...)
 
  Thanx!
   Juergen


pgpMEErYWv5o5.pgp
Description: PGP signature


Re: NVIDIA (port) driver fails to create /dev/nvidactl; 8.2Prerelease

2011-01-30 Thread Michael Remski

Duane:
As a datapoint, I installed the ports/x11/nvidia-driver on a system 
running 8.2 Pre Release from a /usr/src that picked up things from 
yesterday.
FreeBSD payne.remski.net 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #3: Sat Jan 
29 05:26:40 EST 2011 r...@payne.remski.net:/usr/obj/usr/src/sys/PAYNE 
amd64


The video card is a GeForce 210 PCIE card, the version in the Makefile is 
256.53.  I did nothing more than make install the port and adjust my 
xorg.conf.


m
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: KERN - mfi driver for Dell raid h200 on r210 servers

2011-01-30 Thread Damien Fleuriot
On 29 January 2011 23:24, Bjoern A. Zeeb bzeeb-li...@lists.zabbadoz.net wrote:
 On Sat, 29 Jan 2011, Damien Fleuriot wrote:

 Hello lists,



 I'm trying to get FreeBSD 8.0 or 8.1 to run on a Dell poweredge r210
 server.

 It ships with a SATA/SAS h200 RAID controller.


 Sadly, the MFI driver doesn't seem to register for this card...


 Find below the pciconf -lcvb

 --
 none6@pci0:1:0:0:       class=0x010700 card=0x1f1d1028 chip=0x00721000
 rev=0x02 hdr=0x00
   vendor     = 'LSI Logic (Was: Symbios Logic, NCR)'
   class      = mass storage
   subclass   = SAS
   bar   [10] = type I/O Port, range 32, base 0xfc00, size 256, enabled
   bar   [14] = type Memory, range 64, base 0xdf2b, size 65536, enabled
   bar   [1c] = type Memory, range 64, base 0xdf2c, size 262144,
 enabled
   cap 01[50] = powerspec 3  supports D0 D1 D2 D3  current D0
   cap 10[68] = PCI-Express 2 endpoint max data 256(4096) link x8(x8)
   cap 03[d0] = VPD
   cap 05[a8] = MSI supports 1 message, 64 bit
   cap 11[c0] = MSI-X supports 15 messages in map 0x14
 --


 I have added the following to /usr/src/sys/dev/mfi/mfi_pci.c at line 119:
 --
 {0x1000, 0x0072, 0x1028, 0x1f1e, MFI_FLAGS_GEN2,  Dell PERC H200
 Integrated},
 --

 It's 1f1d not 1f1e.  I hope it was only a paste problem into email?



Ok I've loaded the newly patched mfi.ko and booted a MFS image.
Here's the relevant snip from dmesg.run :
at
mfi0: Dell PERC H200 Integrated port 0xfc00-0xfcff mem
0xdf2b-0xdf2b,0xdf2c-0xdf2f irq 16 at device 0.0 on
pci1
mfi0: Megaraid SAS driver Ver 3.00
mfi0: firmware stuck in state 0
mfi0: Firmware not in READY state, error 6


I'll have to try mps then, unless someone has an idea about this
stuck in state 0 thing.
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: KERN - mfi driver for Dell raid h200 on r210 servers

2011-01-30 Thread Ollivier Robert
I've backported the mps driver to 8.2 (I used cp -r :)) and I have generated 
an img suited to the dedibox (that's what you are targeting, right? :))

I tried to test it in vmware but I have a password issue right now.

It is also a ZFSv28 image.

Le 30 janv. 2011 à 01:56, Damien Fleuriot m...@my.gd a écrit :

 On 29 Jan 2011, at 20:26, Andrew Thompson thom...@freebsd.org wrote:
 
 On 30 January 2011 06:20, Damien Fleuriot m...@my.gd wrote:
 Hello lists,
 
 
 
 I'm trying to get FreeBSD 8.0 or 8.1 to run on a Dell poweredge r210 server.
 
 It ships with a SATA/SAS h200 RAID controller.
 
 
 This card may need the mps(4) driver which is only in HEAD at the moment.
 
 
 Andrew
 
 
 Will give this a try if Bjoern's advice doesn't work for me, although I'll 
 come back for directions on how to cleanly port mps on 8.x 
 then.___
 freebsd-sta...@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-stable
 To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
 
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: KERN - mfi driver for Dell raid h200 on r210 servers

2011-01-30 Thread Damien Fleuriot
Indeed that is, the bsd install is aimed at a r210 EG server :)

Is there any place one can get your image ?

---
Fleuriot Damien

On 30 Jan 2011, at 13:10, Ollivier Robert robe...@keltia.net wrote:

 I've backported the mps driver to 8.2 (I used cp -r :)) and I have 
 generated an img suited to the dedibox (that's what you are targeting, right? 
 :))
 
 I tried to test it in vmware but I have a password issue right now.
 
 It is also a ZFSv28 image.
 
 Le 30 janv. 2011 à 01:56, Damien Fleuriot m...@my.gd a écrit :
 
 On 29 Jan 2011, at 20:26, Andrew Thompson thom...@freebsd.org wrote:
 
 On 30 January 2011 06:20, Damien Fleuriot m...@my.gd wrote:
 Hello lists,
 
 
 
 I'm trying to get FreeBSD 8.0 or 8.1 to run on a Dell poweredge r210 
 server.
 
 It ships with a SATA/SAS h200 RAID controller.
 
 
 This card may need the mps(4) driver which is only in HEAD at the moment.
 
 
 Andrew
 
 
 Will give this a try if Bjoern's advice doesn't work for me, although I'll 
 come back for directions on how to cleanly port mps on 8.x 
 then.___
 freebsd-sta...@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-stable
 To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
 
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: KERN - mfi driver for Dell raid h200 on r210 servers

2011-01-30 Thread Bjoern A. Zeeb

On Sun, 30 Jan 2011, Damien Fleuriot wrote:


Ok I've loaded the newly patched mfi.ko and booted a MFS image.
Here's the relevant snip from dmesg.run :
at
mfi0: Dell PERC H200 Integrated port 0xfc00-0xfcff mem
0xdf2b-0xdf2b,0xdf2c-0xdf2f irq 16 at device 0.0 on
pci1
mfi0: Megaraid SAS driver Ver 3.00
mfi0: firmware stuck in state 0
mfi0: Firmware not in READY state, error 6


I'll have to try mps then, unless someone has an idea about this
stuck in state 0 thing.


it means that you should ask Dell for the information as the mfi(4)
driver needs some special handling to support that exact chip.
Probably needs some special initialization and a couple of if ()s, as
usual.

LSI/Dell are the people to talk to.

/bz

--
Bjoern A. Zeeb You have to have visions!
ks Going to jail sucks -- bz All my daemons like it!
  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/jails.html
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: Can vm_mmap()/vm_map_remove() be called with giant held? (linuxolator dvb patches)

2011-01-30 Thread Juergen Lock
On Sun, Jan 30, 2011 at 12:33:20PM +0200, Kostik Belousov wrote:
 On Sun, Jan 30, 2011 at 12:54:48AM +0100, Juergen Lock wrote:
  On Sat, Jan 29, 2011 at 10:51:05PM +0200, Kostik Belousov wrote:
   On Sat, Jan 29, 2011 at 09:10:00PM +0100, Juergen Lock wrote:
Hi!

 I was kinda hoping to be able to post a correct patch in public but
getting an answer to ${Subject} seems to be more difficult than I
thought... :)  So, does anyone here know?  copyout_map() and
   You do not need Giant locked for vm_map* functions.
   
  The question was more do I need to drop it first before calling them...
 No, you do not need to drop Giant.
 
Ok, thanx!

 [snip]
+   error = ENOMEM;
+   goto out2;
+   }
+   error = copyin((void *) vps.props, l_vp, l_propsiz);
+   if (error)
+   goto out2;
+   for (i = vps.num, l_p = l_vp, p = vp; i--; ++l_p, ++p)
+   linux_to_bsd_dtv_property(l_p, p);
+
+   error = copyout_map(td, uvp, propsiz);
+   if (error)
+   goto out2;
+   copyout(vp, (void *) uvp, propsiz);
+
+   if ((error = fget(td, args-fd, fp)) != 0) {
+   (void) copyout_unmap(td, uvp, propsiz);
+   goto out2;
+   }
+   vps.props = (void *) uvp;
+   if ((args-cmd  0x) == LINUX_FE_SET_PROPERTY)
+   error = fo_ioctl(fp, FE_SET_PROPERTY, vps, 
td-td_ucred, td);
+   else
+   error = fo_ioctl(fp, FE_GET_PROPERTY, vps, 
td-td_ucred, td);
+   if (error) {
+   (void) copyout_unmap(td, uvp, propsiz);
+   goto out;
+   }
+   error = copyin((void *) uvp, vp, propsiz);
+   (void) copyout_unmap(td, uvp, propsiz);
   No need in space between cast and expression. Bigger issue is that I
   do not understand this fragment. You do copyout_map(), and then
   immediately call copyout_unmap() for the address range returned
   by copyout_map(), or am I missing something ?
   
   The vm allocated by copyout_map() is only needed for the fo_ioctl()
  call because the struct passed to FE_[GS]ET_PROPERTY describes an
  array that the drivers then copyin() and (possibly) copyout()
  themselves.  So that array needs to be translated from/to the 32bit
  Linux version to (possibly) 64bit on the host (linux_to_bsd_dtv_property),
  and the 64bit version is larger so it doesn't fit in the original
  place in the userland vm.
 And am I right that the drivers can only take this array from the usermode ?

 Yes.  And it's a Linux api and Linux code too (running in webcamd)
so I changing it wouldn't make too much sense.

 How is the compatibility for 32/64 bit mode is handled by native
 FE_SET_PROPERTY handlers ?
 
 I'm not sure but my impression is this currently isn't handled at all
even on Linux.  (And neither on FreeBSD.)

 I could only say that the hack is atrocious. Might be, you indeed have
 no choice there.
  
 I'm not going to disagree there...

 (This is actually the second api for this, i.e. FE_[GS]ET_PROPERTY
are an api extension introduced to add dvb-s2 support to the Linux
dvb api, the original proposal was different but wasn't accepted
by the Linux people in charge.  The array is an array of `commands'
that are executed by the ioctl, and the unused pointer that's in
there on top of the uint32_t reserved1[3] and that causes the sizes
to differ between 32/64 bits looks like it has been added later too
because without it I think each array element would have been exactly
64 bytes...)

 Cheers,
Juergen
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: NVIDIA (port) driver fails to create /dev/nvidactl; 8.2Prerelease

2011-01-30 Thread Duane H. Hesser
On Sun, 30 Jan 2011 05:07:09 -0500 (EST)
Michael Remski mrem...@comcast.net wrote:

 Duane:
 As a datapoint, I installed the ports/x11/nvidia-driver on a system 
 running 8.2 Pre Release from a /usr/src that picked up things from 
 yesterday.
 FreeBSD payne.remski.net 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #3: Sat Jan 
 29 05:26:40 EST 2011 r...@payne.remski.net:/usr/obj/usr/src/sys/PAYNE 
 amd64
 
 The video card is a GeForce 210 PCIE card, the version in the Makefile is 
 256.53.  I did nothing more than make install the port and adjust my 
 xorg.conf.
 
 m

Thanks.  That changes things a bit for me.  I'll try updating
my sources again (they're only 3 days old, but who knows?) build
a new kernel, and re-install the port.

This is the sort of report I needed; thanks.
-- 
Duane H. Hesser dhes...@accima.com
-- 
Duane H. Hesser dhes...@accima.com
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


empty function macros

2011-01-30 Thread Alexander Best
hi there,

i noticed freebsd has a few of the following macros:

#define FUNC(sb)

when you do something like

if (cond)
FUNC(i)

the compiler complains about an if statement with an empty body. any sensible
way of dealing with this issue?

i saw some reiserfs code which does the following to silence compilers:

#define FUNC(sb) do { } while (0)

cheers.
alex

-- 
a13x
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: NVIDIA (port) driver fails to create /dev/nvidactl; 8.2Prerelease

2011-01-30 Thread Doug Barton

On 01/29/2011 18:00, Duane H. Hesser wrote:

I realize that questions such as 'have you kldloaded...
are asked in a helpful spirit, and I don't expect you to be unduly
impressed by my resume, but perhaps you will understand if I find
such questions mildly insulting...


No, I don't understand that at all. If you've read the lists as often as 
you claim to you'd know a few things:


1. These problems usually ARE something simple, and if the OP doesn't 
cover the simple bases, those questions will be asked.


2. The nvidia driver is quite popular, so a widespread failure of the 
driver on a -stable branch would have gotten a lot of notice.


3. The right list to post your report to is freebsd-stable@, not -hackers.

Now please understand, I am not *intending* to be insulting, and as 
someone who has struggled with the nvidia driver myself I'd like to see 
you get your problem resolved.



In any case, good luck.


Doug

--

Nothin' ever doesn't change, but nothin' changes much.
-- OK Go

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: empty function macros

2011-01-30 Thread Gary Jennejohn
On Sun, 30 Jan 2011 17:29:41 +
Alexander Best arun...@freebsd.org wrote:

 hi there,
 
 i noticed freebsd has a few of the following macros:
 
 #define FUNC(sb)
 
 when you do something like
 
 if (cond)
 FUNC(i)
 
 the compiler complains about an if statement with an empty body. any sensible
 way of dealing with this issue?
 
 i saw some reiserfs code which does the following to silence compilers:
 
 #define FUNC(sb) do { } while (0)
 

What happens if you treat it like a real function call and put ';'
after it?

-- 
Gary Jennejohn (gj@)
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: empty function macros

2011-01-30 Thread Alexander Best
On Sun Jan 30 11, Gary Jennejohn wrote:
 On Sun, 30 Jan 2011 17:29:41 +
 Alexander Best arun...@freebsd.org wrote:
 
  hi there,
  
  i noticed freebsd has a few of the following macros:
  
  #define FUNC(sb)
  
  when you do something like
  
  if (cond)
  FUNC(i)
  
  the compiler complains about an if statement with an empty body. any 
  sensible
  way of dealing with this issue?
  
  i saw some reiserfs code which does the following to silence compilers:
  
  #define FUNC(sb) do { } while (0)
  
 
 What happens if you treat it like a real function call and put ';'
 after it?

sorry this was my fault. it should have actually been:

if (cond)
FUNC(i);

basically, since FUNC evaluates to nothing this results in

if (cond)
;

while gcc doesn't complain, clang does.

cheers.
alex

 
 -- 
 Gary Jennejohn (gj@)

-- 
a13x
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org