Re: witness and modules.

2014-12-03 Thread Andriy Gapon
On 03/12/2014 04:33, Julian Elischer wrote:
 On 12/3/14, 12:24 AM, Warner Losh wrote:
 On Dec 1, 2014, at 10:08 PM, Julian Elischer jul...@freebsd.org wrote:

 On 12/1/14, 11:39 PM, John Baldwin wrote:
 On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:
 Do we need to compile all modules with witness definitions when
 linking with a kernel compiled with witness?
 This was true at one stage but I remember some work was done to make
 them compatible.
 You should not need this.  modules always call functions in the kernel for
 lock operations and this functions are what invoke WITNESS.

 that's what I thought but empirical evidence disagrees.
 I'll try some more cases.
 I swap back and forth all the time between the two. Kernel modules don’t
 change when you compile them with WITNESS or without.
 not entirely..
 hwpmc.ko: U witness_restore
 hwpmc.ko: U witness_save
 zfs.ko: U witness_restore
 zfs.ko: U witness_save

Seems like the problem affects modules that use DROP_GIANT / PICKUP_GIANT.

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

Re: witness and modules.

2014-12-03 Thread Julian Elischer

On 12/3/14, 7:26 PM, Andriy Gapon wrote:

On 03/12/2014 04:33, Julian Elischer wrote:

On 12/3/14, 12:24 AM, Warner Losh wrote:

On Dec 1, 2014, at 10:08 PM, Julian Elischer jul...@freebsd.org wrote:

On 12/1/14, 11:39 PM, John Baldwin wrote:

On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:

Do we need to compile all modules with witness definitions when
linking with a kernel compiled with witness?
This was true at one stage but I remember some work was done to make
them compatible.

You should not need this.  modules always call functions in the kernel for
lock operations and this functions are what invoke WITNESS.


that's what I thought but empirical evidence disagrees.
I'll try some more cases.

I swap back and forth all the time between the two. Kernel modules don’t
change when you compile them with WITNESS or without.

not entirely..
hwpmc.ko: U witness_restore
hwpmc.ko: U witness_save
zfs.ko: U witness_restore
zfs.ko: U witness_save

Seems like the problem affects modules that use DROP_GIANT / PICKUP_GIANT.


that's a good observation. I'll take a look a that later.

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

Re: witness and modules.

2014-12-03 Thread John Baldwin
On Wednesday, December 03, 2014 09:53:20 PM Julian Elischer wrote:
 On 12/3/14, 7:26 PM, Andriy Gapon wrote:
  On 03/12/2014 04:33, Julian Elischer wrote:
  On 12/3/14, 12:24 AM, Warner Losh wrote:
  On Dec 1, 2014, at 10:08 PM, Julian Elischer jul...@freebsd.org
  wrote:
  
  On 12/1/14, 11:39 PM, John Baldwin wrote:
  On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:
  Do we need to compile all modules with witness definitions when
  linking with a kernel compiled with witness?
  This was true at one stage but I remember some work was done to make
  them compatible.
  
  You should not need this.  modules always call functions in the kernel
  for
  lock operations and this functions are what invoke WITNESS.
  
  that's what I thought but empirical evidence disagrees.
  I'll try some more cases.
  
  I swap back and forth all the time between the two. Kernel modules don’t
  change when you compile them with WITNESS or without.
  
  not entirely..
  hwpmc.ko: U witness_restore
  hwpmc.ko: U witness_save
  zfs.ko: U witness_restore
  zfs.ko: U witness_save
  
  Seems like the problem affects modules that use DROP_GIANT / PICKUP_GIANT.
 
 that's a good observation. I'll take a look a that later.

Yes, that isn't really intended to be used publically.

The pmc one is stale as system calls haven't run with Giant in several 
releases.

All the ones for g_topology_lock() also seem to be broken-by-designed.  There 
is no good reason I can think of for g_topology_lock() to assert that Giant 
isn't held.  I suspect phk@ just wanted to force geom to be locked without 
Giant, but I'm not sure that is the best way to achieve that?  Poul, is that 
correct?

If you fix that you can remove almost all of the DROP_GIANT/PICKUP_GIANT in 
the tree.  They should really only be in the _sleep() and cv_wait_*() 
functions where they are used to give Giant its special property of being 
dropped while asleep.

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

Re: witness and modules.

2014-12-02 Thread Warner Losh

 On Dec 1, 2014, at 10:08 PM, Julian Elischer jul...@freebsd.org wrote:
 
 On 12/1/14, 11:39 PM, John Baldwin wrote:
 On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:
 Do we need to compile all modules with witness definitions when
 linking with a kernel compiled with witness?
 This was true at one stage but I remember some work was done to make
 them compatible.
 You should not need this.  modules always call functions in the kernel for
 lock operations and this functions are what invoke WITNESS.
 
 that's what I thought but empirical evidence disagrees.
 I'll try some more cases.

I swap back and forth all the time between the two. Kernel modules don’t
change when you compile them with WITNESS or without.

Warner



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: witness and modules.

2014-12-02 Thread Julian Elischer

On 12/3/14, 12:24 AM, Warner Losh wrote:

On Dec 1, 2014, at 10:08 PM, Julian Elischer jul...@freebsd.org wrote:

On 12/1/14, 11:39 PM, John Baldwin wrote:

On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:

Do we need to compile all modules with witness definitions when
linking with a kernel compiled with witness?
This was true at one stage but I remember some work was done to make
them compatible.

You should not need this.  modules always call functions in the kernel for
lock operations and this functions are what invoke WITNESS.


that's what I thought but empirical evidence disagrees.
I'll try some more cases.

I swap back and forth all the time between the two. Kernel modules don’t
change when you compile them with WITNESS or without.

Warner


it's a 10.0 based system.

the zfs kernel module grew a reference to witness_restore and 
witness_save  when it was compiled with witness in opt_global.h.
I certainly wouldn't load with a standard kernel. it may have been 
somethign funny with the zfs compat layer stuff, and I'm pretty sure 
people don't use zfs as a module much, but it was definitely there. 
note: it'd probably work the other way around.. a non-witness module 
would probably load on a witness kernel.. none of the other kernel 
modules had that extra reference so I think it's specific to zfs.   
Maybe to the way it was compiled.. the sources are pretty standard but 
the makefiles are a bit hacked..




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

Re: witness and modules.

2014-12-02 Thread Julian Elischer

On 12/3/14, 12:24 AM, Warner Losh wrote:

On Dec 1, 2014, at 10:08 PM, Julian Elischer jul...@freebsd.org wrote:

On 12/1/14, 11:39 PM, John Baldwin wrote:

On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:

Do we need to compile all modules with witness definitions when
linking with a kernel compiled with witness?
This was true at one stage but I remember some work was done to make
them compatible.

You should not need this.  modules always call functions in the kernel for
lock operations and this functions are what invoke WITNESS.


that's what I thought but empirical evidence disagrees.
I'll try some more cases.

I swap back and forth all the time between the two. Kernel modules don’t
change when you compile them with WITNESS or without.

not entirely..
hwpmc.ko: U witness_restore
hwpmc.ko: U witness_save
zfs.ko: U witness_restore
zfs.ko: U witness_save

Warner



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

Re: witness and modules.

2014-12-01 Thread John Baldwin
On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:
 Do we need to compile all modules with witness definitions when
 linking with a kernel compiled with witness?
 This was true at one stage but I remember some work was done to make
 them compatible.

You should not need this.  modules always call functions in the kernel for 
lock operations and this functions are what invoke WITNESS.

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


Re: witness and modules.

2014-12-01 Thread Julian Elischer

On 12/1/14, 11:39 PM, John Baldwin wrote:

On Friday, November 28, 2014 11:08:35 PM Julian Elischer wrote:

Do we need to compile all modules with witness definitions when
linking with a kernel compiled with witness?
This was true at one stage but I remember some work was done to make
them compatible.

You should not need this.  modules always call functions in the kernel for
lock operations and this functions are what invoke WITNESS.


that's what I thought but empirical evidence disagrees.
I'll try some more cases.

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


witness and modules.

2014-11-28 Thread Julian Elischer
Do we need to compile all modules with witness definitions when 
linking with a kernel compiled with witness?
This was true at one stage but I remember some work was done to make 
them compatible.




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


HEADSUP: WITNESS adn modules == bad juju

2001-01-27 Thread John Baldwin

Boris reminded me of someething I had forgotten to mention: currently unloading
a module that uses mutexes with WITNESS enabled in the kernel will panic the
kernel, cause witness tries to look at the string of the mutex name which is
usually a constant in the module later on.  This leads to a kernel page fault
basically, so until I get this fixed, you really can't unload modules with
WITNESS right now.

-- 

John Baldwin [EMAIL PROTECTED] -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message