kgdb 'next' command crashes kernel during inter-VM kernel debugging

2013-09-02 Thread Yuri
I am trying to debug kernel in one VBox VM from another VBox VM using 
this howto: 
http://census-labs.com/news/2009/01/19/freebsd-kernel-debugging with the 
exception that on the target VM hint.uart.0.flags=0x90 is set instead.


It works, stops at breakpoints, etc. However, kgdb command n (next) 
causes target to reboot.


Device /dev/cuau0 is used for the serial port. On the host it goes 
through the local socket /tmp/com_1

All with FreeBSD 10 (trunk) amd64, virtualbox 4.2.16

Yuri
___
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


Kernel DDB doesn't work in VM ?

2013-08-13 Thread Yuri

I have kernel configured with options KDB and DDB.
But when kernel panic occurs while running as VBox VM, VBox takes over 
and says: A critical error occurred while running the virtual machine, 
etc. It doesn't drop into DDB. Pressing Ok closes VM, pressing Ignore 
leaves it in hung state.


sysctl debug.kdb.enter=1 also causes the above behavior as if panic has 
occurred.


Is it possible to make DDB kick in while running as VM?

Yuri
___
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: Discussing ideas or wish list

2013-08-11 Thread Yuri

On 08/09/2013 09:34, Patrick Dung wrote:

Some (crazy?) ideas:
a) Is it possible to install multiple Perl versions in the same server?
Each third party Perl packages would linked to the corresponding Perl versions?
Users have to update /usr/bin/perl to link to the desired Perl version (or 
using wrapper mechanism like /etc/mail/mail.conf).


Being able to create multiple unique environments on the same host is 
very beneficial.


I believe Oracle Solaris on ZFS is able to install individual packages 
into separate zones, and ZFS can share certain zones between each other.
Manipulating sharing rules allows creation of exactly this: various 
unique set of packages in top-level zones. So for example, perl and all 
its dependent packages can be installed multiple times in multiple 
versions in different ZFS zones on top of shared dependency packages.


Unfortunately, FreeBSD version of ZFS lacks zones.

Yuri
___
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: After the FreeBSD VM crash, file system in VM got rolled back to some old previous state causing data loss

2013-08-07 Thread Yuri

On 08/07/2013 01:56, Wojciech Puchar wrote:


not possible in FreeBSD with UFS.

but if you run virtualbox under linux i cannot say much... 


This happened with FreeBSD guest with UFS (journaled soft-updates) and 
FreeBSD host.

What is out of normal, it rolled back for many hours (~20).

Yuri
___
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


After the FreeBSD VM crash, file system in VM got rolled back to some old previous state causing data loss

2013-08-02 Thread Yuri
I hit this unexpected problem: my host had an ungraceful shutdown while 
FreeBSD 9.1 STABLE was running in the VirtualBox VM. After reboot of the 
host and VM, local ufs file system was missing all recent updates for at 
least 20 hours (!!!)
My question is, how is this possible? Is this related to journaled 
soft-updates which were enabled in VM?
Losing data looks like a critical issue. I had a backup outside VM so no 
real data loss for me, but this is bad.
Fedora VM, that was shut down in the same way didn't suffer from the 
same issue (local ext4).
Host shutdown was caused by the frozen Xorg, I had to kill it and 
reboot. VirtualBox processes got killed in the process.


Yuri
___
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


DTrace copyin with struct doesn't work?

2013-07-24 Thread Yuri

This simple .d script fails:

---script begin---
#!/usr/sbin/dtrace -s

struct my_args {
   int ii;
};

fbt::sys_select:entry
{
  printf(sys_select %i, ((struct my_args*)copyin(arg1, sizeof (struct 
my_args)))-ii);

}
---script end---

dtrace: error on enabled probe ID 1 (ID 33598: 
fbt:kernel:sys_select:entry): invalid address (0xff82ff0799d8) in 
action #1 at DIF offset 40
dtrace: error on enabled probe ID 1 (ID 33598: 
fbt:kernel:sys_select:entry): invalid address (0xff82fefb19d8) in 
action #1 at DIF offset 40


Function sys_select is defined in kern/sys_generic.c:
int
sys_select(struct thread *td, struct select_args *uap)


arg1 in DTrace script should correspond to uap argument of sys_select, 
and dereferencing should always produce an int.


Yuri
___
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


Should process run under chroot(8) still see mounts on the original system?

2013-07-23 Thread Yuri
Currently, mount directories as shown by mount(8) command and 
/compat/linux/dev/mounts from linprocfs(5) still show the original mount 
points as other non-chrooted processes see.
So, when some program run under chroot tries to read the mount points 
and do something with them it would likely fail because those paths 
aren't what the process actually sees in its file system.


There are two situations: one when the process was started already 
chrooted (like with command chroot(8)), and another one is when process 
calls chroot(2) itself. Currently system seems to not differentiate 
between these two cases.


It looks reasonable to automatically modify mount(8) and linprocfs(5) 
results when the process has been started already chrooted and this 
process is (practically) always unaware of chroot. So that when chroot 
was in place when execve(2), kernel could set the boolean flag and later 
adjust mount directories accordingly.


I hit this issue while playing with GoogleTalk plugin (the linux app). I 
am running it in chroot environment, since it requires the higher linux 
libraries version than are currently installed on the host. It runs and 
connects to the browser plugin. But when it reads 
/compat/linux/dev/mounts in order to find /dev/shm (linux shm_open(3) 
function), it sees the wrong paths there and fails. It can't statfs the 
mount point.


Yuri
___
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: Should process run under chroot(8) still see mounts on the original system?

2013-07-23 Thread Yuri

On 07/23/2013 16:31, Mateusz Guzik wrote:

Of course then you may have some unnecessary separation but that I
believe can be simply worked out if it turns out to be problematic.



jail would completely separate two systems. In my case this app also 
communicates through files that it creates and host app reads through 
symbolic links. It might also be assuming that it runs on the same host 
and maybe is unable to connect to X server other than through the shared 
memory.


Such functionality can be made optional through some sysctl variable.

Yuri
___
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: Kernel crashes after sleep: how to debug?

2013-07-19 Thread Yuri

On 07/19/2013 08:00, John Baldwin wrote:

Well, you can probably find the value of 'm' in a register if you look at the
dissassembly around the fault.  You can then cast that pointer to the right
type and print its contents.


Here is the value of *m in frame 8:
(kgdb) p *(struct vm_page*)0xfe00b460abf8
$3 = {pageq = {tqe_next = 0xfe26, tqe_prev = 0xfe00b5a124d8}, listq 
= {tqe_next = 0xfe0081ad8f70, tqe_prev = 0xfe0081ad8f78},
left = 0x6, right = 0xd0201, object = 0x1, pindex = 
4294901765, phys_addr = 18446741877712530608, md = {pv_list = {
tqh_first = 0xfe00b460abc0, tqh_last = 0xfe00b5579020}, pat_mode 
= -1268733096}, queue = 72 'H', segind = -85 '�',
hold_count = -19360, order = 0 '\0', pool = 254 '�', cow = 65535, 
wire_count = 0, aflags = 0 '\0', flags = 0 '\0', oflags = 0,

act_count = 0 '\0', busy = 176 '�', valid = 208 '�', dirty = 126 '~'}


Yuri
___
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: Kernel crashes after sleep: how to debug?

2013-07-19 Thread Yuri

On 07/19/2013 14:04, John Baldwin wrote:

Hmm, that definitely looks like garbage.  How are you with gdb scripting?
You could write a script that walks the PQ_ACTIVE queue and see if this
pointers ends up in there.  It would then be interesting to see if the
previous page's next pointer is corrupted, or if the pageq.tqe_prev references
that page then it could be that this vm_page structure has been stomped on
instead.


As you suggested, I printed the list of pages. Actually, iteration in 
frame 8 goes through PQ_INACTIVE pages. So I printed those.

...skipped...
### page#2245 ###
$4492 = (struct vm_page *) 0xfe00b5a27658
$4493 = {pageq = {tqe_next = 0xfe00b5a124d8, tqe_prev = 
0xfe00b5b79038}, listq = {tqe_next = 0x0, tqe_prev = 
0xfe00b5a276e0},
  left = 0x0, right = 0x0, object = 0xfe005e3f7658, pindex = 5, 
phys_addr = 1884901376, md = {pv_list = {tqh_first = 0xfe005e439ce8,
  tqh_last = 0xfe00795eacc0}, pat_mode = 6}, queue = 0 '\0', 
segind = 2 '\002', hold_count = 0, order = 13 '\r', pool = 0 '\0',
  cow = 0, wire_count = 0, aflags = 1 '\001', flags = 64 '@', oflags = 
0, act_count = 9 '\t', busy = 0 '\0', valid = 255 '�', dirty = 255 '�'}

### page#2246 ###
$4494 = (struct vm_page *) 0xfe00b5a124d8
$4495 = {pageq = {tqe_next = 0xfe00b460abf8, tqe_prev = 
0xfe00b5a27658}, listq = {tqe_next = 0x0, tqe_prev = 
0xfe005e3f7cf8},
  left = 0x0, right = 0x0, object = 0xfe005e3f7cb0, pindex = 1, 
phys_addr = 1881952256, md = {pv_list = {tqh_first = 0xfe005e42dd48,
  tqh_last = 0xfe007adb03a8}, pat_mode = 6}, queue = 0 '\0', 
segind = 2 '\002', hold_count = 0, order = 13 '\r', pool = 0 '\0',
  cow = 0, wire_count = 0, aflags = 1 '\001', flags = 64 '@', oflags = 
0, act_count = 9 '\t', busy = 0 '\0', valid = 255 '�', dirty = 255 '�'}

### page#2247 ###
$4496 = (struct vm_page *) 0xfe00b460abf8
$4497 = {pageq = {tqe_next = 0xfe26, tqe_prev = 0xfe00b5a124d8}, 
listq = {tqe_next = 0xfe0081ad8f70, tqe_prev = 0xfe0081ad8f78},
  left = 0x6, right = 0xd0201, object = 0x1, pindex = 
4294901765, phys_addr = 18446741877712530608, md = {pv_list = {
  tqh_first = 0xfe00b460abc0, tqh_last = 0xfe00b5579020}, 
pat_mode = -1268733096}, queue = 72 'H', segind = -85 '�',
  hold_count = -19360, order = 0 '\0', pool = 254 '�', cow = 65535, 
wire_count = 0, aflags = 0 '\0', flags = 0 '\0', oflags = 0,

  act_count = 0 '\0', busy = 176 '�', valid = 208 '�', dirty = 126 '~'}
### page#2248 ###
$4498 = (struct vm_page *) 0xfe26

The page #2247 is the same that caused the problem in frame 8. tqe_next 
is apparently invalid, so iteration stopped here.
It appears that this structure has been stomped on. This page is 
probably supposed to be a valid inactive page.





Ultimately I think you will need to look at any malloc/VM/page operations
done in the suspend and resume paths to see where this happens.  It might
be slightly easier if the same page gets trashed every time as you could
print out the relevant field periodically during suspend and resume to
narrow down where the breakage occurs.


I am thinking to put code walking through all page queues and verifying 
that they are not damaged in this way into the code when each device is 
waking up from sleep.
dev/acpica/acpi.c has acpi_EnterSleepState, which, as I understand, 
contains top-level code for S3 sleep. Before sleep it invokes event 
'power_suspend' on all devices, and after sleep it calls 'power_resume' 
on devices. So maybe I will call the page check procedure after 
'power_suspend' and 'power_resume'.


But it is possible that memory gets damaged somewhere else after 
power_resume happens.

Do you have any thought/suggestions?

Yuri
___
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: Kernel crashes after sleep: how to debug?

2013-07-18 Thread Yuri

On 07/16/2013 08:07, John Baldwin wrote:

Can you go to frame 8 and do 'l' in kgdb?


(kgdb) up 8
#8  0x80baea78 in vm_pageout () at /usr/src/sys/vm/vm_pageout.c:829
829 if (!VM_OBJECT_TRYLOCK(object) 
(kgdb) l
824 if (!vm_pageout_page_lock(m, next)) {
825 vm_page_unlock(m);
826 continue;
827 }
828 object = m-object;
829 if (!VM_OBJECT_TRYLOCK(object) 
830 !vm_pageout_fallback_object_lock(m, next)) {
831 vm_page_unlock(m);
832 VM_OBJECT_UNLOCK(object);
833 continue;

___
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: Kernel crashes after sleep: how to debug?

2013-07-18 Thread Yuri

On 07/18/2013 11:42, John Baldwin wrote:

Hmm, so this seems to indicate you have a page on the active queue that
doesn't have an associated VM object.  Can you maybe 'p *m'?  Maybe some
temporary page is allocated during suspend but isn't freed appropriately?


Unfortunately, I get this:
(kgdb) p *m
No symbol m in current context.

even though kernel was built with makeoptions DEBUG=-g, same for 
other symbols there.


Is there a way to identify when and by whom the page has been allocated?

Yuri
___
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: Kernel crashes after sleep: how to debug?

2013-07-18 Thread Yuri

On 07/18/2013 13:52, John Baldwin wrote:

Are you in frame 8?


Yes.

Yuri
___
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: Kernel crashes after sleep: how to debug?

2013-07-18 Thread Yuri

On 07/18/2013 13:52, John Baldwin wrote:

Are you in frame 8?


For some reason the debug info is missing in frame 8, but is present in 
surrounding frames 7 and 9.
The might be a bug in makefiles that debug flag isn't passed into 
sys/vm/ directory.


Yuri
___
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


Kernel crashes after sleep: how to debug?

2013-07-15 Thread Yuri


After sleep/wakeup cycle my 9.1-STABLE r253105 amd64 system has a 
tendency to sometimes randomly crash after a while. It doesn't happen 
every time.
See kgdb log below. I am not sure there is enough information to lead to 
the cause of the issue.


It looks like it crashes near the line:
#7  0x8091a181 in _mtx_trylock (m=0x1, opts=0, 
file=value optimized out, line=0) at /usr/src/sys/kern/kern_mutex.c:295

295 if (SCHEDULER_STOPPED())
Current language:  auto; currently c
(kgdb) l
290 uint64_t waittime = 0;
291 int contested = 0;
292 #endif
293 int rval;
294
295 if (SCHEDULER_STOPPED())
296 return (1);
297
298 KASSERT(m-mtx_lock != MTX_DESTROYED,
299 (mtx_trylock() of destroyed mutex @ %s:%d, file, 
line));


Current thread was:
* 67 Thread 100064 (PID=5: pagedaemon)  doadump (textdump=value 
optimized out) at pcpu.h:234


How to find the cause of the crash?

Yuri


--- kgdb log ---
# kgdb /boot/kernel/kernel vmcore.0
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.

Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as amd64-marcel-freebsd...

Unread portion of the kernel message buffer:


Fatal trap 12: page fault while in kernel mode
cpuid = 0; apic id = 00
fault virtual address   = 0x10018
fault code  = supervisor read data, page not present
instruction pointer = 0x20:0x8091a181
stack pointer   = 0x28:0xff80d51c6ab0
frame pointer   = 0x28:0xff80d51c6ad0
code segment= base 0x0, limit 0xf, type 0x1b
= DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags= interrupt enabled, resume, IOPL = 0
current process = 5 (pagedaemon)
trap number = 12
panic: page fault
cpuid = 0
KDB: stack backtrace:
#0 0x80968416 at kdb_backtrace+0x66
#1 0x8092e43e at panic+0x1ce
#2 0x80d12940 at trap_fatal+0x290
#3 0x80d12ca1 at trap_pfault+0x211
#4 0x80d13254 at trap+0x344
#5 0x80cfc583 at calltrap+0x8
#6 0x80baea78 at vm_pageout+0x998
#7 0x808fc10f at fork_exit+0x11f
#8 0x80cfcaae at fork_trampoline+0xe
Uptime: 2h21m27s
Dumping 407 out of 2919 MB:..4%..12%..24%..32%..44%..52%..63%..71%..83%..91%

Reading symbols from /boot/modules/cuse4bsd.ko...done.
Loaded symbols for /boot/modules/cuse4bsd.ko
Reading symbols from /boot/kernel/linux.ko...Reading symbols from 
/boot/kernel/linux.ko.symbols...done.

done.
Loaded symbols for /boot/kernel/linux.ko
Reading symbols from /usr/local/libexec/linux_adobe/linux_adobe.ko...done.
Loaded symbols for /usr/local/libexec/linux_adobe/linux_adobe.ko
Reading symbols from /boot/kernel/radeon.ko...Reading symbols from 
/boot/kernel/radeon.ko.symbols...done.

done.
Loaded symbols for /boot/kernel/radeon.ko
Reading symbols from /boot/kernel/drm.ko...Reading symbols from 
/boot/kernel/drm.ko.symbols...done.

done.
Loaded symbols for /boot/kernel/drm.ko
#0  doadump (textdump=value optimized out) at pcpu.h:234
234 pcpu.h: No such file or directory.
in pcpu.h
(kgdb) bt
#0  doadump (textdump=value optimized out) at pcpu.h:234
#1  0x8092df16 in kern_reboot (howto=260) at 
/usr/src/sys/kern/kern_shutdown.c:449
#2  0x8092e417 in panic (fmt=0x1 Address 0x1 out of bounds) at 
/usr/src/sys/kern/kern_shutdown.c:637
#3  0x80d12940 in trap_fatal (frame=0xc, eva=value optimized 
out) at /usr/src/sys/amd64/amd64/trap.c:879
#4  0x80d12ca1 in trap_pfault (frame=0xff80d51c6a00, 
usermode=0) at /usr/src/sys/amd64/amd64/trap.c:795
#5  0x80d13254 in trap (frame=0xff80d51c6a00) at 
/usr/src/sys/amd64/amd64/trap.c:463
#6  0x80cfc583 in calltrap () at 
/usr/src/sys/amd64/amd64/exception.S:232
#7  0x8091a181 in _mtx_trylock (m=0x1, opts=0, 
file=value optimized out, line=0) at /usr/src/sys/kern/kern_mutex.c:295

#8  0x80baea78 in vm_pageout () at /usr/src/sys/vm/vm_pageout.c:829
#9  0x808fc10f in fork_exit (callout=0x80bae0e0 
vm_pageout, arg=0x0, frame=0xff80d51c6c40)

at /usr/src/sys/kern/kern_fork.c:988
#10 0x80cfcaae in fork_trampoline () at 
/usr/src/sys/amd64/amd64/exception.S:606

#11 0x in ?? ()

___
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: Kernel crashes after sleep: how to debug?

2013-07-15 Thread Yuri

On 07/15/2013 00:22, Yuri wrote:

How to find the cause of the crash?


I added WITNESS and related options and next crash produced such messages:
Jul 15 03:25:53 satellite kernel: panic: Bad link elm 0xfe00b780d000 
next-prev != elm

Jul 15 03:25:53 satellite kernel: cpuid = 1
Jul 15 03:25:53 satellite kernel: KDB: stack backtrace:
Jul 15 03:25:53 satellite kernel: #0 0x8094b846 at 
kdb_backtrace+0x66

Jul 15 03:25:53 satellite kernel: #1 0x809129c8 at panic+0x1d8
Jul 15 03:25:53 satellite kernel: #2 0x80b83994 at 
vm_page_requeue+0xe4

Jul 15 03:25:53 satellite kernel: #3 0x80b896c4 at vm_pageout+0xb04
Jul 15 03:25:53 satellite kernel: #4 0x808e3f65 at fork_exit+0x135
Jul 15 03:25:53 satellite kernel: #5 0x80cd72de at 
fork_trampoline+0xe



Process was pagedaemon, like before.

Yuri
___
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


DVD burner failure on FreeBSD: the LUN appears to be stuck

2013-06-03 Thread Yuri
I have DVD burner Pioneer DVR-112D failing on FreeBSD-9.1 amd64. It 
begins to write ok, but later gets stuck at some percentage point with 
the LUN appears to be stuck message (log is below).

Command used to burn is:
$ growisofs -dvd-compat -speed=4 -Z /dev/acd0=my.iso
growisofs is from dvd+rw-tools-7.1, which hasn't been updated from 2008.
cd0: PIONEER DVD-RW  DVR-112D 1.21 Removable CD-ROM SCSI-0 device

Now there is a dilemma. Does this mean that the burner went bad? Or does 
this mean that there is some fault in the burner driver?

I know that few years ago this burner worked fine on BSD.

Maybe anybody has an expertise and would know if this error means the 
hardware or software failure?

Anybody is able to burn DVDs with the same/similar burner?
Or maybe some other command should be used for burning? (growisofs is 
recommended by the handbook)


Googling the message doesn't clarify the issue.

Yuri



--- error log ---
 1072726016/8061945856 (13.3%) @0.0x, remaining 86:00 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 86:19 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 86:45 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 87:05 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 87:24 RBU 100.0% UBU 100.0%
  072726016/8061945856 (13.3%) @0.0x, remaining 87:50 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 88:10 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 88:30 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 88:56 RBU 100.0% UBU 100.0%
:-? the LUN appears to be stuck writing LBA=7fe10h, keep retrying in 141ms
 1072726016/8061945856 (13.3%) @0.0x, remaining 89:15 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 89:35 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 90:01 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 90:20 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 90:40 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 91:06 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 91:25 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 91:45 RBU 100.0% UBU 100.0%
:-? the LUN appears to be stuck writing LBA=7fe10h, keep retrying in 141ms
 1072726016/8061945856 (13.3%) @0.0x, remaining 92:11 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 92:31 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 92:50 RBU 100.0% UBU 100.0%
 1072726016/8061945856 (13.3%) @0.0x, remaining 93:16 RBU 100.0% UBU 100.0%
^C/dev/pass0: flushing cache

___
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


What is the correct way to declare assembler global variable ?

2013-05-03 Thread Yuri
I am trying to compile this code fragment into my program (taken from 
lib/libc/amd64/sys/sbrk.S):

void my_func() {
 ...
  __asm__ __volatile__(
  movq .curbrk(%%rip), %%rax;
  lea  .curbrk(%%rip), %%rdx;
  movq %%rax, %0;
  movq %%rdx, %1;
  : =r (my_curbrk),
=r (my_curbrk_ptr)
  :: %rax, %rdx);
  ...
}

I get a warning:
/usr/bin/ld: warning: type and size of dynamic symbol 
`.curbrk@@FBSDprivate_1.0' are not defined


What is the correct way to declare .curbrk in in-place assembly?

Yuri
___
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: What is the correct way to declare assembler global variable ?

2013-05-03 Thread Yuri

On 05/03/2013 13:30, Konstantin Belousov wrote:

Formal answer is for you to read about the .type directive in the GNU
as manual. Also, you need to read about either common symbols, or about
the .size directive.

But, note that you cannot access hidden libc symbols from the code which
links to libc (dynamically). You probably need to re-consider higher-level
approach to your issue.



I didn't write this code. This is google-perftools-2.0 I am trying to port.
They added the procedure do_sbrk there (see below), that attempts to 
emulate what libc is doing for sbrk. It fails, they probably didn't test it.

The idea is that they need to have hooks before and after sbrk call.
I am not sure what the best approach would be here?
How can the memory allocation library override sbrk in libc and still be 
able to attach to the original libc version of sbrk?


On Linux there is another symbol __sbrk, and they just use it to conenct 
to the original sbrk. But there is no such thing of FreeBSD.


Yuri


static inline void* do_sbrk(intptr_t increment) {
  void* curbrk = 0;

#if defined(__x86_64__) || defined(__amd64__)
# ifdef PIC
  __asm__ __volatile__(
  movq .curbrk@GOTPCREL(%%rip), %%rdx;
  movq (%%rdx), %%rax;
  movq %%rax, %0;
  : =r (curbrk)
  :: %rdx, %rax);
# else
  __asm__ __volatile__(
  movq .curbrk(%%rip), %%rax;
  movq %%rax, %0;
  : =r (curbrk)
  :: %rax);
# endif
#else
  __asm__ __volatile__(
  movl .curbrk, %%eax;
  movl %%eax, %0;
  : =r (curbrk)
  :: %eax);
#endif

  if (increment == 0) {
return curbrk;
  }

  char* prevbrk = static_castchar*(curbrk);
  void* newbrk = prevbrk + increment;

  if (brk(newbrk) == -1) {
return reinterpret_castvoid*(static_castintptr_t(-1));
  }

  return prevbrk;
}

extern C void* sbrk(intptr_t increment) __THROW {
  MallocHook::InvokePreSbrkHook(increment);
  void *result = do_sbrk(increment);
  MallocHook::InvokeSbrkHook(result, increment);
  return result;
}

___
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


helgrind (valgrind plugin) errors coming from nsdispatch(3)

2013-03-24 Thread Yuri
While running helgrind on my program, I observed several errors that 
stem from the nsdispatch calls, see helgrind log below.
lock order error in helgrind is generated when some data is protected 
by two mutexes, and they were locked in different order on different 
occasions.
I think, mutexes in question are nss_lock and conf_lock in 
lib/libc/net/nsdispatch.c


It seems like authors of helgrind took an approach that such situation 
is error prone in general, thus they point it out.


So what would be the prevalent judgement here, is this something worth 
fixing in libc, or such errors should be ignored?


9.1-STABLE amd64
valgrind-3.8.0_1,1

Yuri



---helgrind log---
==6736== Thread #1: lock order 0x282B150 before 0x282B190 violated
==6736==
==6736== Observed (incorrect) order is: acquisition of lock at 0x282B190
==6736==at 0x155AA4F: pthread_mutex_trylock (hg_intercepts.c:550)
==6736==by 0x25B87F8: nsdispatch (in /lib/libc.so.7)
==6736==by 0x25A3C50: getpwuid_r (in /lib/libc.so.7)
==6736==by 0x3153EAA: ???
==6736==by 0x3152B5D: ???
==6736==by 0x3074F3C: ???
==6736==by 0x8225A6: myfunc2(bool) (my1.cpp:146)
==6736==by 0x5FC14A: myfunc1(int, char**) (my2.cpp:39)
==6736==by 0x5E5B61: main (main.cpp:326)
==6736==
==6736==  followed by a later acquisition of lock at 0x282B150
==6736==at 0x155C27F: pthread_rwlock_wrlock_WRK (hg_intercepts.c:1479)
==6736==by 0x25B8818: nsdispatch (in /lib/libc.so.7)
==6736==by 0x25A3C50: getpwuid_r (in /lib/libc.so.7)
==6736==by 0x3153EAA: ???
==6736==by 0x3152B5D: ???
==6736==by 0x3074F3C: ???
==6736==by 0x8225A6: myfunc2(bool) (my1.cpp:146)
==6736==by 0x5FC14A: myfunc1(int, char**) (my2.cpp:39)
==6736==by 0x5E5B61: main (main.cpp:326)
==6736==
==6736== Required order was established by acquisition of lock at 0x282B150
==6736==at 0x155C44F: pthread_rwlock_rdlock_WRK (hg_intercepts.c:1532)
==6736==by 0x25B8126: nsdispatch (in /lib/libc.so.7)
==6736==by 0x25A3C50: getpwuid_r (in /lib/libc.so.7)
==6736==by 0x3153EAA: ???
==6736==by 0x3152B5D: ???
==6736==by 0x3074F3C: ???
==6736==by 0x8225A6: myfunc2(bool) (my1.cpp:146)
==6736==by 0x5FC14A: myfunc1(int, char**) (my2.cpp:39)
==6736==by 0x5E5B61: main (main.cpp:326)
==6736==
==6736==  followed by a later acquisition of lock at 0x282B190
==6736==at 0x155AA4F: pthread_mutex_trylock (hg_intercepts.c:550)
==6736==by 0x25B87F8: nsdispatch (in /lib/libc.so.7)
==6736==by 0x25A3C50: getpwuid_r (in /lib/libc.so.7)
==6736==by 0x3153EAA: ???
==6736==by 0x3152B5D: ???
==6736==by 0x3074F3C: ???
==6736==by 0x8225A6: myfunc2(bool) (my1.cpp:146)
==6736==by 0x5FC14A: myfunc1(int, char**) (my2.cpp:39)
==6736==by 0x5E5B61: main (main.cpp:326)

___
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


top(1) doesn't report the correct CPU time for a multithreaded process

2013-03-13 Thread Yuri
I have a process that is CPU bound with 1 thread in its first 5 seconds, 
then it creates 200 threads that are all reading/writing from the 
network, and becomes network bound for the other 6.5min.
When I look at this process in top(1), right after 200 threads are 
created, I see WCPU and CPU values around 3400% and then it goes down to 
the values below 1% for the rest of the run:

50619 yuri  206  200   621M   555M uwait   7   0:31 0.68% myapp

In the end, after all threads have quit, process measures its resources 
with getrusage(RUSAGE_SELF, u); and it shows that CPU time consumed was 
like this:

user=104609ms sys=8758ms wall=395938ms

So real CPU percentage wasn't ~0.68%, but was more like 25%. Or maybe 
it is 6% if to consider 400% the max (there are 4 cores). I am inclined 
to trust getrusage(2).


It was this PR, that is now marked as closed with patch checked in: 
http://www.freebsd.org/cgi/query-pr.cgi?pr=127331
But it doesn't seem like this code from the patch is even in 
usr.bin/top/machine.c now (9.1-STABLE).
My original PR, considered a duplicate, is also closed: 
http://www.freebsd.org/cgi/query-pr.cgi?pr=135823


Why top(1) doesn't show the correct CPU time, aggregate for all threads? 
Is this a regression of the patch in the above PR#127331?

Also, why do I ever see 3400% CPU time? This doesn't seem right in any case.

Yuri

___
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


Calling ustack(); from DTrace script crashes the user process

2013-01-25 Thread Yuri
I am calling ustack(); from the 'ioctl' handler called by Xorg process. 
My intention is to see the user stack.

On the first few instances I got this error:
dtrace: ERROR: open  failed: No such file or directory
-- no file name is mentioned, double-space is printed in the message

After a while the same exact script began to crash Xorg process.

Before crashes occurred I was able to get the truss log, showing that 
multiple dev-files failed to open:

 5191: open(/dev/dtrace/dtrace,O_RDONLY,00)= 3 (0x3)
 5191: open(/dev/dtrace/io,O_RDONLY,00)ERR#2 'No such file or 
directory'

 5191: open(/dev/dtrace/dtmalloc,O_RDONLY,00)  = 4 (0x4)
 5191: open(/dev/dtrace/nfscl,O_RDONLY,00) ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/nfsclient,O_RDONLY,00) ERR#2 'No such file or 
directory'

 5191: open(/dev/dtrace/fbt,O_RDONLY,00)   = 5 (0x5)
 5191: open(/dev/dtrace/lockstat,O_RDONLY,00)  = 6 (0x6)
 5191: open(/dev/dtrace/priv,O_RDONLY,00)  ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/sched,O_RDONLY,00) ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/mac,O_RDONLY,00)   ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/mac_framework,O_RDONLY,00) ERR#2 'No such 
file or directory'
 5191: open(/dev/dtrace/cbb,O_RDONLY,00)   ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/sctp,O_RDONLY,00)  ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/callout_execute,O_RDONLY,00) ERR#2 'No such 
file or directory'
 5191: open(/dev/dtrace/vfs,O_RDONLY,00)   ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/proc,O_RDONLY,00)  ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/syscall,O_RDONLY,00)   ERR#2 'No such file or 
directory'
 5191: open(/dev/dtrace/syscall,O_RDONLY,00)   ERR#2 'No such file or 
directory'


I satisfied all conditions mentioned in https://wiki.freebsd.org/DTrace 
on how to run DTrace on 9.0 (I am on 9.1-STABLE). kernel modules are 
loaded, see below.


So:
* Why/How ustack kills the user process? (amazing this is even possible)
* Why files like /dev/dtrace/io don't exist?

Maybe some extra-options are required for ustack() to work? If this is 
the case this should be mentioned in wiki.


Yuri


# kldstat
Id Refs AddressSize Name
 3   16 0x81861000 84c0 opensolaris.ko
 44 0x8186a000 53a00linux.ko
101 0x82612000 9e50 linprocfs.ko
121 0x82627000 25b  linux_adobe.ko
132 0x82628000 baa  dtraceall.ko
141 0x82629000 4eca profile.ko
153 0x8262e000 4005 cyclic.ko
16   12 0x82633000 23baaf   dtrace.ko
171 0x8286f000 fae8 systrace_freebsd32.ko
181 0x8287f000 109a5systrace.ko
191 0x8289 45a8 sdt.ko
201 0x82895000 4938 lockstat.ko
211 0x8289a000 be09 fasttrap.ko
221 0x828a6000 65e2 fbt.ko
231 0x828ad000 4ee4 dtnfsclient.ko
241 0x828b2000 1dbebnfsclient.ko
251 0x828d 47da nfs_common.ko
261 0x828d5000 55ec dtnfscl.ko
271 0x828db000 4597 dtmalloc.ko
281 0x828e 44fd dtio.ko
291 0x828e5000 2466 dtrace_test.ko
___
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: Why DTrace sensor is listed but not called?

2013-01-24 Thread Yuri

On 01/22/2013 16:03, Ryan Stone wrote:

Offhand, I can't of why this isn't working.  However there is already a way
to add new DTrace probes to the kernel, and it's quite simple, so you could
try it:


Thank you for this information, this works.

As for my previous approach, there is a bug in gcc that static empty 
functions with 'noinline' attributes get eliminated by the optimizer.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56099

Yuri
___
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


Why DTrace sensor is listed but not called?

2013-01-22 Thread Yuri
I tried to create my own DTrace sensors (for debugging purposes) through 
adding of the simple function like this:

static u_int
xxx_my_trace(int arg) {
  return 1;
}

It is listed in dtrace -l with its entry and return sensors.
 8143fbtkernel xxx_my_trace entry
 8144fbtkernel xxx_my_trace return
This function is called, I know for sure because it is called from 
another procedure which does get traced by DTrace.

However, these sensors are never triggered when run through dtrace(1M)
#!/usr/sbin/dtrace -s
::xxx_my_trace:entry
{
  printf(xxx_my_trace);
}
It does print the following, but nothing else:
dtrace: script './dt.d' matched 1 probe

Adding __attribute__((noinline)) doesn't help.

What is the problem? Why dtrace sensors aren't invoked?

Yuri
___
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


How to validate the variable size memory block in ioctl handler?

2013-01-20 Thread Yuri
I am implementing an ioctl that reads/writes variable size structure. 
Allocated size is supplied by the caller in the structure itself.

struct my_struct {
  int len; // allocated size
  other_struct s[1];
};
ioctl request id is defined as _IOWR('X', number, my_struct)

How to validate from the ioctl function handler (for some device) that 
the whole (variable size) block of bytes is RW accessible in the process 
memory space?

Should I call copyout/copyin for this, or there is some shorter way?
EFAULT should be returned in case of validation failure.

As I understand, macros like _IOR, _IOWR do validation based on the size 
of structure supplied to them. So that the handler procedures don't have 
to do that.
I was expecting to find among them some macro that would work for such 
variable size structure, but it isn't there. (Not sure if this is 
possible language-wise).


Yuri
___
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: How to validate the variable size memory block in ioctl handler?

2013-01-20 Thread Yuri

On 01/20/2013 16:59, m...@freebsd.org wrote:

To do what you want it sounds like you want your handler to take something like:

struct var_ioctl {
 int len;
 void *data;
};

Then then handler itself would have to use copyin/copyout to access
the data.  There's no simpler way.


I think I found the simpler way, see the draft patch below.
Generic macro _IOWRE will handle the case when the first integer in 
ioctl parameter holds the actual size of the structure.
This way of passing the variable array sizes is quite common in various 
APIs.

Other potential uses would also benefit from this.

Yuri


Index: sys/kern/sys_generic.c
===
--- sys/kern/sys_generic.c  (revision 245654)
+++ sys/kern/sys_generic.c  (working copy)
@@ -640,6 +640,7 @@
int arg, error;
u_int size;
caddr_t data;
+   int vsize;
 
 	if (uap-com  0x) {

printf(
@@ -654,6 +655,14 @@
 * copied to/from the user's address space.
 */
size = IOCPARM_LEN(com);
+   if (size == IOC_VARIABLE) {
+   /* first integer has the length of the memory */
+   error = copyin(uap-data, (caddr_t)vsize, sizeof(vsize));
+   if (error)
+   return (error);
+   size = (u_int)vsize;
+   }
if ((size  IOCPARM_MAX) ||
((com  (IOC_VOID  | IOC_IN | IOC_OUT)) == 0) ||
 #if defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
Index: sys/sys/ioccom.h
===
--- sys/sys/ioccom.h(revision 245654)
+++ sys/sys/ioccom.h(working copy)
@@ -50,6 +50,7 @@
 #defineIOC_IN  0x8000  /* copy in parameters */
 #defineIOC_INOUT   (IOC_IN|IOC_OUT)
 #defineIOC_DIRMASK (IOC_VOID|IOC_OUT|IOC_IN)
+#defineIOC_VARIABLEIOCPARM_MASK/* parameters size in 
parameters */
 
 #define	_IOC(inout,group,num,len)	((unsigned long) \

((inout) | (((len)  IOCPARM_MASK)  16) | ((group)  8) | (num)))
@@ -59,6 +60,9 @@
 #define_IOW(g,n,t) _IOC(IOC_IN,(g), (n), sizeof(t))
 /* this should be _IORW, but stdio got there first */
 #define_IOWR(g,n,t)_IOC(IOC_INOUT, (g), (n), sizeof(t))
+#define_IORE(g,n)  _IOC(IOC_OUT,   (g), (n), IOC_VARIABLE)
+#define_IOWE(g,n)  _IOC(IOC_IN,(g), (n), IOC_VARIABLE)
+#define_IOWRE(g,n) _IOC(IOC_INOUT, (g), (n), IOC_VARIABLE)
 
 #ifdef _KERNEL




___
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: How to validate the variable size memory block in ioctl handler?

2013-01-20 Thread Yuri

On 01/20/2013 19:15, m...@freebsd.org wrote:

This would be fine for a local patch but it breaks existing (valid)
uses that have exactly 8191 bytes of data, so it wouldn't be suitable
for the main FreeBSD repository.  Also, in general one wants to have
limits on syscalls that can force a kernel malloc of any size, as it
leads to denial of service attacks or crashes by requesting the kernel
over-allocate memory.


Both problems are easily fixable.
Current len range can be preserved by encoding this case into an 'inout' 
parameter of _IOC instead. IOC_VOID is only used when no IOC_IN/IOC_OUT 
is set, so all 3 bits would mean _IORWE.
And arbitrarily high parameter size can be explicitly limited in 
sys_generic.c to IOCPARM_MAX.


Yuri
___
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


Is there a way to prioritize disk operations ?

2013-01-15 Thread Yuri
Currently one can set nice value to the process. But it only affects the 
CPU scheduling, so if this process is CPU bound it would yield to others.
What if the process is disk-bound, like some backup operations? The 
backup copying large disk seriously affects performance of all other 
apps accessing the same disk.


Is there a way to set the priority value on the process for the disk 
operations, so that all disk operations originating from the process 
will be scheduled in similar way how CPU is scheduled based on the nice 
value of the process? The disk-intense backup process with low disk 
priority won't affect the other processes at all.


Yuri
___
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


How to overload the system call in the userland program?

2012-11-30 Thread Yuri
I am looking into one library (google-perftools) that attempts to 
overload sbrk(2).
In Linux libc translates calls, ex. sbrk - __sbrk (in libc), so one can 
define their own version, call extern __sbrk and it works.

FreeBSD programs connect to the symbol sbrk@@FBSD_1.0

So what is the way to overload the system call like this would be in linux?:

extern C void* __sbrk(ptrdiff_t increment);
extern C void* sbrk(intptr_t increment) {
  return__sbrk(increment);
}

Yuri

___
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: pgbench performance is lagging compared to Linux and DragonflyBSD?

2012-11-06 Thread Yuri

On 11/05/2012 12:52, Garrett Cooper wrote:
FWIW, I think that the last time scheduler benchmarks from anyone at 
@FreeBSD.org (was kris@ the last one, or has flo@ run benchmarks since 


I myself ran the similar test on i7 920 (4 cores 8 threads) @ 2.67 24GB 
with 9.1-RC3 with all the same params except shmem size was 4GB, not 
6GB: http://i.imgur.com/mfnqr.png
In DragonflyBSD tests FreeBSD peaked at 96k tps. And my machine, with 
roughly 3X lesser power, peaked at 44.5k tps. So in my test BSD 
performed relatively better. And graph shape is more resembling 
linux/DragonflyBSD ones. It looks like in their test FreeBSD behaved in 
somewhat impaired way.


Any ideas what can I try to tune?

Yuri
___
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: pgbench performance is lagging compared to Linux and DragonflyBSD?

2012-11-06 Thread Yuri

On 11/06/2012 11:10, Samuel J. Greear wrote:

Single and multi-socket hardware are not really directly comparable in
PostgreSQL tests.


So if the CPUs are split between sockets, would such system generally 
perform better or worse with PostgeSQL vs. non-split situation?


Yuri
___
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


pgbench performance is lagging compared to Linux and DragonflyBSD?

2012-11-05 Thread Yuri
There is the post by DragonflyBSD folks that claims that Linux and 
DragonflyBSD are quite ahead of FreeBSD on pgbench test on 12 Core 2x 
Xeon X5650 with 24 threads.
Here are their results with graphs: 
http://lists.dragonflybsd.org/pipermail/users/attachments/20121010/7996ff88/attachment-0002.pdf
And here is their original post: 
http://lists.dragonflybsd.org/pipermail/users/2012-October/017536.html


I am not sure if this is the problem of some sysctl or kernel parameters 
or some serious system issue.


It looks like the DragonflyBSD folks made a goal to do well on pgbench 
and got to the level of ~88% of linux with 80 clients.


Yuri
___
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: 'device atapicam' breaks the build

2012-10-29 Thread Yuri

On 10/28/2012 21:52, Erich Dollansky wrote:

# options   ATA_CAM # Handle
legacy controllers with CAM
# options   ATA_STATIC_ID   # Static device numbering

It looks like you have to disable above's options.


Unfortunately the root disk on this machine is attached to ata3 and 
isn't visible when 'device ATA_CAM' is commented out. (mountroot prompt 
shows up on boot only listing ahci-compatible disks).
Does this mean that in order to see such (older) disks I have to have 
'device ATA_CAM'? Or there is some workaround?
Does it also mean that atapicam won't load in case such older disks are 
in use? If yes, why there is such dependency?


Yuri
___
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: 'device atapicam' breaks the build

2012-10-29 Thread Yuri

On 10/29/2012 00:27, Yuri wrote:
Unfortunately the root disk on this machine is attached to ata3 and 
isn't visible when 'device ATA_CAM' is commented out. (mountroot 
prompt shows up on boot only listing ahci-compatible disks). 


Actually BIOS has the option to present SATA as AHCI, so this solves the 
problem.


Yuri
___
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


'device atapicam' breaks the build

2012-10-28 Thread Yuri
Following atapicam(4), I added 'device atapicam' into 
sys/amd64/conf/GENERIC. This causes 'make buildkernel' to fail:


ld  -d -warn-common -r -d -o zlib.ko.debug zlib.o
: export_syms
awk -f /usr/src/sys/conf/kmod_syms.awk zlib.ko.debug  export_syms | 
xargs -J% objcopy % zlib.ko.debug

objcopy --only-keep-debug zlib.ko.debug zlib.ko.symbols
objcopy --strip-debug --add-gnu-debuglink=zlib.ko.symbols zlib.ko.debug 
zlib.ko

1 error
*** [buildkernel] Error code 2
1 error
*** [buildkernel] Error code 2
1 error

Also loading it manually with 'kldload atapicam' fails:
kldload: can't load atapicam: Exec format error
with system log having an error: link_elf_obj: symbol ata_controlcmd 
undefined


What is wrong with atapicam?

I need atapicam because section 23.3.3 of handbook suggests that it is a 
prerequisite for being able to use DVD drive from the vbox guests.


Yuri

9.1-RC3

___
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: How to boot FreeBSD and linux from FreeBSD MBR?

2012-10-27 Thread Yuri

On 10/27/2012 02:42, matt wrote:

This means you have grub2. It is slow as molasses and has to be the mbr.
You could chainload freebsd's partition under a separate entry, like
Windows The partition bootcode for FreeBSD will boot it from there. You
can also boot loader or kernel directly from grub, your choice.


So you are saying I can't keep BSD MBR and boot linux from under it when 
linux uses grub2?


Is it still possible to still use lilo? I vaguely remember that it used 
to work like this.


Yuri
___
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


How to boot FreeBSD and linux from FreeBSD MBR?

2012-10-26 Thread Yuri
When I installed ubuntu on another partition, it overwrote BSD MBR with 
grub one.

Now grub boots ubuntu without even asking what to boot.
When I tried to restore BSD MBR, BSD boots but linux doesn't. This is 
because there is no bootable PBR in linux partition.
When I tried to install grub into PBR on its own partition, like someone 
online suggested, it refused with the message that this is dangerous, etc.


So is there a way to boot both linux and BSD from BSD MBR (by pressing 
F2 or whatever)?

Are there quick instructions anywhere?
I just don't want grub to take over the boot process.

Yuri

___
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


Why fdisk can't open root disk with MBR for writing?

2012-09-14 Thread Yuri

I am trying to change the active partition in MBR.
This should be a matter of changing only two bits (clearing one in one 
byte and setting another one in another byte).


However, fdisk complains:
fdisk: Failed to write MBR. Try to use gpart(8).

truss reveals that fdisk failed to open the root disk for writing:
open(/dev/ad4,O_RDWR,00)   ERR#1 'Operation not 
permitted'

open(/dev/ad4,O_RDONLY,00) = 3 (0x3)
...
...
pwrite(0x3,0x34048200,0x200,0x0,0x0,0x0) ERR#9 'Bad file descriptor'
Failed to write MBR. Try to use gpart(8)

The question is: why the disk can't be open RW under root?
The secondary issue is the bug in fdisk: once -a option is supplied and 
it can't open it RW it should just say so, and not suggest using gpart 
because gpart will probably have the same issue.


Yuri
___
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: Why fdisk can't open root disk with MBR for writing?

2012-09-14 Thread Yuri

On 09/14/2012 19:23, Warren Block wrote:
Did you actually try gpart?  GEOM prevents writes to providers that 
are in use, but gpart should handle it correctly if the problem is 
just that fdisk doesn't understand GEOM.


# gpart set -a active -i 1 ada0

If that fails, the provider is in use, usually mounted.  The safety 
can be disabled, but it's better to figure out what has it in use. 


Yes it is the hard drive with mounted /. But changing the active slice 
should be safe in any case.

gpart worked.
This safety feature is protecting people from themselves. Sounds very 
familiar.


Thanks!
Yuri

___
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: How to diagnose system freezes?

2012-08-27 Thread Yuri

On 08/27/2012 13:04, Dieter BSD wrote:

Have you found a way to trigger the bug on demand?

Since you suspect the nvidia-driver-285.05.09, try some other
driver, and do whatever triggers the bug and see if you get the freeze.


No, I didn't find any way to trigger the problem on purpose.
295.71 driver (current version) doesn't work right away after start but 
doesn't freeze OS.
Older 285.05.09 version appears to work fine for a long while (1-2 
days), then freezes OS.
I am pretty sure anybody will see the problem if they try this version 
of driver with 9400 GT card.



 


If you can demonstrate that the various nvidia drivers are broken
in various ways, submit a problem report to whoever wrote the drivers
(Nvidia presumably). If Nvidia supports their products, then they
will fix their drivers. If they don't support their products,
why would you want to reward them by buying another nvidia card?


I did send the bug report to NVidia's address 
freebsd-gfx-b...@nvidia.com. So far no response.
I am not sure how such one way, secretive, PR handling works in general 
for any product. So not sure how NVidia can manage it. No way to track 
the issue with NVidia.



Yuri
___
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: How to diagnose system freezes?

2012-08-25 Thread Yuri

On 07/31/2012 17:20, Attilio Rao wrote:

Start by adding SW_WATCHDOG to your machine with a reasonably low timeout.
Also, can you use a serial console? If yes you may consider going with
a serial break.


The difference with the GENERIC is mainly the addition of these lines, 
which make it debug image and add SW_WATCHDOG, etc. (also add dtrace)

options KDTRACE_FRAME# Ensure frames are compiled in
options KDTRACE_HOOKS# Kernel DTrace hooks
options DDB_CTF
makeoptions WITH_CTF=1
makeoptions DEBUG=-g
options SW_WATCHDOG
options DIAGNOSTIC
options DDB  # Support DDB.
options GDB  # Support remote GDB

Npw, with this config, system doesn't hang indefinitely. Instead, it 
hangs for ~1 minute and then reboots. It doesn't drop into debugger and 
doesn't leave anything in messages.


I didn't yet try 4BSD scheduler as Doug Barton suggested.

Anything else I can try?

One thing of importance here is that there is an older graphics card 
9400 GT on this system and current nvidia-driver-295.71 has an issue 
with 9400 GT: it makes graphics to malfunction (unpainted windows, long 
delays switching to terminal mode) or freezes Xorg (but not OS). So I 
run the older nvidia-driver-285.05.09 which appears to work.
That's why I think that nvidia driver is probably to blame for these 
periodic OS freezes. Also the latest driver version must be, obviously, 
working for most people because (I think) they mostly have newer than 
mine nvidia cards. So maybe I should also just get the newer nvidia card 
and shut up, not sure.


Yuri
___
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: How to diagnose system freezes?

2012-08-25 Thread Yuri

On 08/25/2012 13:11, Andriy Gapon wrote:

options KDB
options KDB_TRACE
options KDB_UNATTENDED


KDB and KDB_TRACE are on by default in 9.1 that I am running.

Yuri
___
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: Is there any modern alternative to pstack?

2012-08-06 Thread Yuri

On 04/16/2012 06:59, John Baldwin wrote:

I'm fine with putting it into the base.  If so, we should import 1.2 first I
think and then apply the 1.3 patch.


So are there plans to import it into the base? Maybe for 9.1?
/usr/ports/sysutils/pstack is still i386 only.

Yuri
___
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


How to diagnose system freezes?

2012-07-31 Thread Yuri
One of my 9.1-BETA1 systems periodically freezes. If sound was playing, 
it would usually cycle with a very short period. And system stops being 
sensitive to keyboard/mouse. Also ping of this system doesn't get a 
response.
I would normally think that this is the faulty memory. But memory was 
recently replaced and tested with memtest+ for hours both before and 
after freezes and it passes all tests.
One out of the ordinary thing that is running on this system is nvidia 
driver. But the freezes happen even when there is no graphics activity.
Another out of the ordinary thing is that the kernel is built for 
DTrace. But DTrace was never used in the sessions that had a freeze.


What is the way to diagnose this problem?

CPU: i7 CPU 920  @ 2.67GHz
Memory: 24GB
MB: P2T

Yuri
___
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: How to diagnose system freezes?

2012-07-31 Thread Yuri

On 07/31/2012 17:50, Mark Saad wrote:

Yuri
   Install sysutils/mcelog and try running the example included . While not a 
complete definitative hardware test it can report other hardware issues that 
memtest86+ misses and it can be run on line in multiuser mode and via cron .


Thanks for suggesting this. I have a question, however. Let's say 
'mcelog --daemon' runs and encounters some MCE and logs it. Wouldn't 
this record be lost during the subsequent ungraceful (poweroff) reboot? 
Nonfatal MCEs, if any, will stay but what about the fatal one?


Yuri
___
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: Better error messages for command not found (was Re: Pull in upstream before 9.1 code freeze?)

2012-07-05 Thread Yuri

On 07/05/2012 09:37, Wojciech Puchar wrote:

no it isn't. unless it would be extra keypress for that.

i don't want to be treated as a moron just as when i use google search 
with javascript active.


I agree, this feature isn't useful on linux. In 100% of cases it got 
engaged for me it was a result of typo.


It would be useful to have a command that finds the port name(s) by the 
command name when needed though.
Today, for example, while searching for package that has a command 
'svlc' I do 'cd /usr/ports  make search key=svlc' and it finds nothing 
instead of finding multimedia/vlc. make search seems to search through 
package names, dependency names, but not command names for some reason.


Maybe this would be the reasonable feature to implement first instead of 
changing the missing command handlers in shells.


Yuri

___
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: Pull in upstream before 9.1 code freeze?

2012-07-04 Thread Yuri

On 07/04/2012 15:08, Doug Barton wrote:

First, I agree that being able to turn it off should be possible. But I
can't help being curious ... why would you*not*  want a feature that
tells you what to install if you type a command that doesn't exist on
the system?


Given the potentially controversial nature of this feature, it's maybe 
best to almost completely isolate it from the base system and make it 
into a port.
When this port is installed and when some special environment variable 
points to its executable, shells would call this executable when an 
unknown command is typed by the user.
Such implementation should leave all parties happy. People who hate it 
just wouldn't install this port.


Yuri
___
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-driver-295.49 is highly unstable

2012-07-03 Thread Yuri

On 05/27/2012 13:08, Alexey Dokuchaev wrote:

Perhaps you can try asking on official nVidia FreeBSD forum:

http://www.nvnews.net/vbulletin/forumdisplay.php?f=47


I reported there 05-28-12, but got no response.
Do you know if there is a way to report a problem with NVidia? For 
example, is there a for example bugzilla or other bug reporting system 
for this?
In addition, I observe system hangup for a few seconds when running 
glxinfo. Also I observe Xorg freeze when I run nvidia-settings.

So I have to run 285.05.09 from cvs instead.

Yuri
___
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: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket

2012-07-02 Thread Yuri

On 07/02/2012 01:26, Adrian Chadd wrote:

Ok, so something is really really odd here. Are you able to dig deeper
into what the socket code in xorg is doing wrong? It'd certainly be
nice to fix all of this stuff up.

Thanks so much for digging into this! It's been annoying me, but I've
just been ridiculously busy trying to bring up some more Atheors wifi
chipset support in FreeBSD.


To begin with, I filed the xorg PR for this to see what xorg maintainers 
think of this issue, if anything at all:

https://bugs.freedesktop.org/show_bug.cgi?id=51648
I find it hard to believe that nobody ever fixed this issue on any 
platform where xorg is running.


Yuri
___
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: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket

2012-07-02 Thread Yuri



Ok, so something is really really odd here. Are you able to dig deeper
into what the socket code in xorg is doing wrong? It'd certainly be
nice to fix all of this stuff up.

Thanks so much for digging into this! It's been annoying me, but I've
just been ridiculously busy trying to bring up some more Atheors wifi
chipset support in FreeBSD.


Now it is clear what is happening.
Xlib routinely calls read one more time during every X-protocol call one 
extra time, kinda just in case. And such calls always fail with EAGAIN, 
unless disconnect or socket error happens to happen at this time. This 
essentially about doubles the number of system calls that any X app makes.


Yuri
___
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: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket

2012-07-02 Thread Yuri


On 07/02/2012 15:32, Alexander Kabaev wrote:

Pardon my possibly naive question, but isn't using errno to detect
whether the syscall is succesful a wrong techique? Syscall will NOT
change errno unless unless it actually failed, so unless dtrace's errno
emulation is more magic than I thought, your script will mistakenly
attribute error code coming from a distant past to syscalls just
complete with no errors?


I didn't think about this at all, just picked this script from some website.
But now I did an experiment: in the test process I placed on failing 
open(2) call and next to it a succeeding one.
And this dtrace script only shows one failed open(2) call, not two as 
you would expect if errno was indeed preserved between them.


So maybe there is some magic to it in dtrace functionality.

Someone more familiar with the matter maybe can explain this.

Yuri
___
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: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket

2012-07-01 Thread Yuri

On 07/01/2012 08:57, Adrian Chadd wrote:

I haven't yet done digging to see if poll() is returning the xorg
socket as being ready. I think that's worth doing.

And it's a huge problem for battery consumption.:)


For simple qt4 apps, reads in question originate from libxcb from 
_xcb_in_read function.

I tried to replace read with poll in there but poll just blocks:
//int n = read(c-fd, c-in.queue + c-in.queue_len, 
sizeof(c-in.queue) - c-in.queue_len);

struct pollfd fds = {c-fd, POLLIN|POLLERR|POLLHUP, INFTIM};
int n = poll(fds, 1, INFTIM);

poll hangs during the third call in simple test app, because 
poll_for_response is called during XFlush when it is nothing to actually 
read.
So some of libX11 code should be changed to only call poll when response 
is expected.

Otherwise it looks like poll indeed returns xorg socket as being ready.

Yuri
___
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: System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket

2012-07-01 Thread Yuri

On 07/01/2012 13:27, Adrian Chadd wrote:

Hm, can you try it with an xorg TCP socket versus an xorg UNIX socket
and see if the behaviour differs?


TCP connection exhibits exactly the same behavior.

Yuri
___
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


System is flooded with failed read(2) calls: Resource temporarily unavailable (errno=35) coming from xorg unix socket

2012-06-29 Thread Yuri
When I run dtrace script (attached) on 9.0 amd64 with kde4 I see a lot 
of failed read(2) calls from the xorg socket /tmp/.X11-unix/X0 .
This can't be right in my opinion. This means that code keeps reading 
from this socket and failing, instead of using select(2) or kquere(2).
Requests mostly come from kdeinit4 but some also from kwin, chrome and 
even Xorg itself.

Rate of failure for read(2) calls is ~2500/sec systemwide.

This is of course not a deadly problem.
But is this situation considered to be normal?

Yuri

--- dtrace script---
!/usr/bin/perl
use Getopt::Std;

#
#  Defaults
#
$FILTER = ;
$COUNT = 0;

#
#  Command line arguments
#
Usage() if $ARGV[0] eq --help;
getopts('ch:n:p:') || Usage();
Usage() if $opt_h;
$COUNT = 1 if $opt_c;
$FILTER =  execname == \$opt_n\ if defined $opt_n;
$FILTER =  pid == $opt_p if defined $opt_p;

#
#  Load errno descriptions
#
open(ERRNO,/usr/include/sys/errno.h) || die ERROR1: reading errno.h: 
$!\n;

while (chomp($line = ERRNO)) {
next unless $line =~ /^#define/;
($errno,$desc) = $line =~ /^#define\s+\S+\s+(\d+)\s+\/\*(.*)\*\//;
$Errno{$errno} = $desc;
}
close ERRNO;

#
#  Declare DTrace script
#
 if ($COUNT) {  # aggregate style
$dtrace = END;
/usr/sbin/dtrace -n '
#pragma D option quiet
syscall:::return
/errno != 0  pid != \$pid $FILTER/
{
\@Errs[execname, probefunc, errno] = count();
}
dtrace:::END {
printa(%s %s %d %\@d\\n, \@Errs);
}'
END
 } else {   # snoop style
$dtrace = END;
/usr/sbin/dtrace -n '
#pragma D option quiet
#pragma D option switchrate=5hz
syscall::read:entry
{
  self-fd = arg0;
}
syscall::read:return
/errno != 0  pid != \$pid $FILTER/
{
printf(%d %s %s %d\\n, pid, execname, probefunc, errno);
printf(fd=%d\\n,self-fd);
}'
END
 }

#
#  Cleanup on signals
#
$SIG{INT} = \Cleanup_Signal;# Ctrl-C
$SIG{QUIT} = \Cleanup_Signal;   # Ctrl-\
$SIG{TERM} = \Cleanup_Signal;   # TERM

#
#  Run DTrace, process output
#

if ($COUNT) {
print STDERR Sampling... Hit Ctrl-C to end.\n;
$header = 1;
} else {
printf(%16s %16s %4s  %s\n,EXEC,SYSCALL,ERR,DESC);
}

### Open DTrace
open(DTRACE,$dtrace |) || die ERROR2: Can't start dtrace (perms?): $!\n;

### Process DTrace output
while (chomp($line = DTRACE)) {

### Print count header
if ($COUNT  $header) {
printf(\n%16s %16s %16s %4s %6s  %s\n,
 PID, EXEC,SYSCALL,ERR,COUNT,DESC);
$header = 0;
}

### Split data
($pid,$execname,$syscall,$errno,$counts) = split(' ',$line);
if ($errno eq ) {printf(DESCR %s\n, $line);}
next if $errno eq ;

### Fetch errno description
$desc = $Errno{$errno};

### Print output line
if ($COUNT) {
printf(%16s %16s %16s %4d %6d %s\n,
 $pid, $execname,$syscall,$errno,$counts,$desc);
} else {
printf(%16s %16s %16s %4d 
%s\n,$pid,$execname,$syscall,$errno,$desc);

}
}
close(DTRACE);

#
#  Triggered by signals
#
sub Cleanup_Signal {
}

#
#  Usage message
#
sub Usage {
print STDERR USAGE: errinfo [-ch] [-p PID] [-n name]\n;
print STDERR ENDUSAGE;
 eg,
   errinfo   # default output - snoop event style
  -c # counts - aggregate style
  -p 871 # examine PID 871 only
  -n ssh # examine processes with the name ssh only
  -cn ssh# examine ssh using counts
ENDUSAGE
exit(1);
}

___
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-driver-295.49 is highly unstable

2012-06-04 Thread Yuri

On 06/04/2012 00:54, Pegasus Mc Cleaft wrote:
You know what it could be? I just had to rebuild my user-land 
because of KDE updates and I use variables in my make.conf to switch 
between base GCC and CLANG. I forgot to switch back to base gcc before 
compiling the nvidia driver. I installed the driver and rebooted, xorg 
came up but as soon as I logged in, kwin crashed, then the machine 
kernel panicked and rebooted. I rebooted and crashed a few more times 
before realizing what I had done. I recompiled the driver with GCC and 
the machine has been rock-stable with the nvidia driver.


Maybe the OP has done the same thing and not realized it?


Unfortunately, that's not the case. I wish it was.

Yuri
___
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


nvidia-driver-295.49 is highly unstable

2012-05-27 Thread Yuri
After the recent system upgrade that brought nvidia-driver-295.49 my 
system began to malfunction.
Xorg randomly freezes and gets to 100% CPU (in kde4), switching back 
from the black terminal takes 30 seconds, some windows don't repaint 
while windows effects are on, etc.

Switching back to 295.05.09 from Feb 11, 2012 fixed the problem.

9400GT

I can't believe this is only my problem. I think the version should be 
rolled back until the problem is fixed.


Yuri
___
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-driver-295.49 is highly unstable

2012-05-27 Thread Yuri

On 05/27/2012 10:01, David Wolfskill wrote:

So, at least in my case, I respectfully disagree with the assessment in
the Subject.


i386 is one difference (I use amd64)
FX 770M is another difference (I use 9400GT)
I also have everything updated with the similar portmaster command.

Yuri
___
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't unload snd_uaudio: it hangs in D+ state

2012-04-23 Thread Yuri

On 04/22/2012 22:54, Hans Petter Selasky wrote:


If it says in dmesg that an application is using a device, that is a problem
with the PCM layer, that doesn't support detach of devices if they are in use.


Other snd_xxx.ko can't be unloaded when in use, ex:
# kldunload snd_es137x.ko
kldunload: can't unload file: Device busy

Something is different with snd_usound.ko

Yuri
___
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


Can't unload snd_uaudio: it hangs in D+ state

2012-04-22 Thread Yuri

I was debugging Logitech C910 webcam.
1. 'kldload snd_uaudio' while camera was attached
2. ran webcamd, which worked
3. stopped webcamd
4. 'kldunload snd_uaudio' while the camera is still attached = hanged in D+
5. 'kldstat' also hangs in D+
I didn't really use usound, just loaded the module.

What is wrong with snd_uaudio?

Yuri
___
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


Why make(1) doesn't support the internal macro $ ?

2012-04-21 Thread Yuri

When I run 'make' on the following makefile, $@ gets printed but $ doesn't.

Why?

Yuri


--- Makefile ---
file-out: file-in
@echo target= $@  src= $; touch $@

___
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: Is there any modern alternative to pstack?

2012-04-15 Thread Yuri

On 04/05/2012 07:06, John Baldwin wrote:

In this case we probably should become the upstream maintainer.  My patch
actually bumps the version to 1.3 as it is sort of intended to do that.


bsd-pstack on SourceForge is dead. Sole project owner isn't responsive, 
and as per SF policy they don't allow anyone to take over such project. 
They suggest to fork.
So will you object if I create a new project on SF, say bsd-pstack-new, 
will import the current source and apply your patch and make a release?

I will also update pstack port so that it will become current.

Yuri
___
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: Is there any modern alternative to pstack?

2012-04-15 Thread Yuri

On 04/15/2012 02:30, Konstantin Belousov wrote:

It seems that the license is two-clause BSD.
My opinion is that such tool should be imported into the base.


I agree, this is the best option. This is a very low level tool, 
somewhat similar to or extending procstat(1).


Yuri
___
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


cp -R from the mounted ufs disk image hangs in DL+ vnread

2012-04-11 Thread Yuri
I have an 82GB UFS image file (ufs-snapshot) mounted on some directory 
ufs-snapshot.mount. (mount /dev/`mdconfig -a -t vnode -f ufs-snapshot` 
ufs-snapshot.mount)


Command 'cp -R ufs-snapshot.mount/usr other-dir/' hanged in the middle 
with DL+ status:

$ ps ax | grep cp
73635  10  DL+ 0:12.19 cp -R ufs-snapshot.mount/usr other-dir/
'top' shows it in vnread state:
73635 root1  200 10084K  2672K vnread  1   0:12  0.00% cp

When I ran 'ls' in the same mounted directory it hanged too with D+ status:
$ ps ax | grep ls
75882   2  D+  0:00.00 ls ufs-snapshot.mount/

What is happening? Why cp and ls hanged?
I think, cp -R hanged first and later ls is waiting on some op initiated 
by cp -R.

Somehow, cp -R managed to hang itself.

How can I find out what cp is waiting on?

9.0-STABLE amd64

Yuri
___
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: cp -R from the mounted ufs disk image hangs in DL+ vnread

2012-04-11 Thread Yuri

I created a PR for this: http://www.freebsd.org/cgi/query-pr.cgi?pr=166851
___
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: Is there any modern alternative to pstack?

2012-04-04 Thread Yuri

On 04/04/2012 05:44, Eitan Adler wrote:

Not unless someone decides to become the new upstream and make a
release. We do not maintain software in ports.

-- Eitan Adler


But upstream is the sourceforge. Even though there is no activity there 
for a long while, it is easy to join that project, commit the change and 
make a release.

It's better than to keep private patches.

Yuri
___
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: Is there any modern alternative to pstack?

2012-04-02 Thread Yuri

On 04/02/2012 05:31, John Baldwin wrote:

Hmm, I don't know if the port has it, but I did some work on pstack a while
ago to make it work with libthread_db so it at least handles i386 ok.  It
needs to be modified to use something like libunwind though or some other
unwinder.  And possibly it should use libelf instead of its own ELF-parsing
code.


I see pstack -1.2_1 failing even on i386:

pstack: cannot read context for thread 0x1879f
pstack: failed to read more threads
1947: /usr/local/share/chromium/chrome
- thread 100255 -
 0x1879f  ()

- thread -1 (running) -
 0x389f1df9 __sys_recvmsg (3, bfbfcd44, 0, bfbfcd68, 0, c) + 5
 0x97850b4 _init (3, bfbfcdc8, 800, bfbfdc20, bfbfdc4c, bfbfdc40) + 15c7c1c
 0xa8089d0 _init (bfbfe074, 3, 0, bfbfe0c4, 20, bfbfdca0) + 264b538
 0xa8094d7 _init (bfbfe44c, 0, bfbfe108, 37a85517, 37aa7680, 38fbf400) 
+ 264c03f

 0x8e7ec02 _init (bfbfe44c, bfbfe4a0, 3c, 0, 0, 0) + cc176a
 0x8e7f102 _init (bfbfe468, bfbfe44c, bfbfe4a0, 37a9f4b4, 37aa5d40, 1) 
+ cc1c6a
 0x8e7f471 _init (2, bfbfe540, bfbfe4a0, 88f9c28, bd4dce8, bd4de88) + 
cc1fd9
 0x81c64ab _init (2, bfbfe540, bfbfe4e8, af61795, bfbfe500, bfbfe540) + 
9013

 0x81c6452 _init (0, 0, bfbfe518, 81c63a7, 2, bfbfe540) + 8fba
 0x81c63a7 _init (3791afd0, 2, bfbfe540, 0, 0, 0) + 8f0f
 0x81c6318 _init (bfbfe6d0, bfbfe6f1, 0, bfbfe6ff, bfbfe762, bfbfe7b8) 
+ 8e80



Yuri

___
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


Is there any modern alternative to pstack?

2012-03-31 Thread Yuri
I look at seemingly abandoned sysutils/pstack, last modified upstream 
2002-11-27.

It doesn't really work on 9.0 i386, prints some errors.

It's functions, though, is quite desirable if one wants to understand 
why some multithreaded program hangs or is not responsive.
Since there were no updates, I wonder, is this because there is some 
alternative in FreeBSD that I don't know about, or it is primarily due 
to the lack of interest/resources?


I don't take gdb as alternative since it is not single line, and also it 
has some threading issues of its own.


Yuri
___
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: Is there any modern alternative to pstack?

2012-03-31 Thread Yuri

On 03/31/2012 14:22, Jason Hellenthal wrote:

procstat(1)



I don't see which key of procstat(1) displays this information.
The closest key is:
-k  Display the stacks of kernel threads in the process
It shows kernel threads, but no user space stacks. How can I get user 
space stacks?


Yuri
___
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 I take a snapshot of the current stack for every thread in some process from outside?

2012-03-03 Thread Yuri

On 03/02/2012 17:07, Gavin Mu wrote:

ports/sysutils/pstack can do this if you use x86 machine.


After fixing obvious compile issues on amd64, symbol _thread_list 
can't be found. Looks like hash algorithm is correct and finds other 
symbols, just not _thread_list.


I don't know where to go from here.

Yuri
___
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


Can I take a snapshot of the current stack for every thread in some process from outside?

2012-03-02 Thread Yuri
I have the multithreaded process, each thread has some stack state at 
each point of time. For example during the timer tick when processes are 
switched?

Is there a way to take a snapshot without disrupting a process?

I was thinking gdb, but it requires the process to exit the system call 
to attach (?).

DTrace is only activated particular sensors are crossed.

So is there such a tool/command?

Yuri
___
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


Why /dev/dsp can get into Device busy state?

2012-02-17 Thread Yuri
At some point, after killing audio playing app with Ctrl-C, I am unable 
to play sound again with the same app:

Can't open audio device /dev/dsp: Device busy
But after closing virtual box windows guest, sound is working again.

What bothers me, why audio device can even become busy? Isn't it 
supposed to mix all inputs no matter how many? It usually works fine 
with many apps playing sound at the same time.

What exactly is the condition that causes sound device to become busy?
Driver in use is snd_es137x.

fstat /dev/dsp doesn't show who opened sound device for some reason.

Yuri
___
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


compiler configuration regression in 9.0?

2012-01-18 Thread Yuri
One port build (www/neon29) fails for me on 9.0 (i386, freshly upgraded 
from 8.2), configure fails with the message: cpp: error trying to exec 
'cc1': execvp: No such file or directory
I tracked in down to the PATH variable passed to cpp, when PATH begins 
with /usr/local/bin, cpp breaks in 9.0. But when the same /usr/local/bin 
is in the end of the path it works fine.
I also noticed that in 9.0 gcc is 4.2.1 and in 8.2 gcc is 4.2.2, which 
may be related.

What might be a problem with this?

Yuri

--- testcase ---
#!/bin/sh

echo  conftest.c  __END__
/* confdefs.h */
#ifdef __STDC__
# include limits.h
#else
# include assert.h
#endif
__END__

# BREAKS 9.0, works in 8.2
export PATH=/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
# WORKS everywhere
#export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

cpp  -I/usr/local/include  conftest.c

___
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: FreeBSD has serious problems with focus, longevity, and lifecycle

2012-01-16 Thread Yuri

On 01/16/2012 17:03, Atom Smasher wrote:


i bought myself a LENOVO T510 when it first came out, around early 
2010. it's got an i5 CPU and Arrandale GPU. it's two years old and on 
freeBSD i STILL can't run xorg properly with it. linux has run fine 
with it since i opened the box. last i checked, freeBSD will be 
support this GPU in R9... or maybe R10...?


The usual explanation for this is that FreeBSD is the server OS and 
doesn't need to worry about desktop-only hardware. (Not that I agree 
with such position.)
I noticed that FreeBSD overall  isn't too good for laptops (correct me 
if I am wrong). Even if Arrandale GPU worked, there is no working 
network manager in kde or gnome, able to find and setup WiFi networks 
without user typing anything. Also FreeBSD isn't able to enter (and come 
back from) the sleep mode. Also it can't stop the hard drives when the 
system is idle (last time I tried I got system crash). These make it 
very difficult to use FreeBSD on the laptops. Major usability issues.


Yuri
___
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


Sound on the system briefly interrupts when kde4 switches windows with nvidia card

2012-01-15 Thread Yuri
I have kde4 on 8.2 with translucency windows effect enabled and nvidia 
graphics driver.
Every time I switch an active window or maximize some window, sound 
played by mplayer interrupts for ~0.5 sec. Very annoying effect. Problem 
disappears when windows effects in kde4 are turned off.
Is this likely a bug in nvidia driver that it locks up the system when a 
lot of OpenGL operations are in progress? Or what might be a problem?


Yuri
___
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: Sound on the system briefly interrupts when kde4 switches windows with nvidia card

2012-01-15 Thread Yuri

On 01/15/2012 15:34, Dieter BSD wrote:

Some drivers do things like DELAY(big number) while interrupts are turned
off. Very bad. Look through the source, maybe you can find it.

We REALLY need a way to service one device without shutting off
interrupts from other devices.


NVidia driver is closed source and ships with many binaries. But code 
immediately interacting with kernel is open and it does call DELAY and 
also tsleep(9)


Yuri
___
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: Sound on the system briefly interrupts when kde4 switches windows with nvidia card

2012-01-15 Thread Yuri

On 01/15/2012 22:33, Julian H. Stacey wrote:

This might help ?
man mplayer:
  -priority
  -cache
man rtprio


as per mplayer(1) -priority only works on Windows and OS/2. -cache 
doesn't help, setting higher priority with rtprio doesn't help either.

The only thing that helps is turning off window effects.

Yuri
___
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: top(1) loses process user time count when threads end

2012-01-03 Thread Yuri

On 01/03/2012 09:13, John Baldwin wrote:

I can't tell how recent your kernel/world are though from your message to see
if you have both of these changes.


My kernel/userland were from Aug 17, 2011. Probably before the change in 
question.

I will retest with the latest 8.2.

Yuri
___
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


ZFS installs on HD with 4k physical blocks without any warning as on 512 block size device

2011-08-18 Thread Yuri
Some latest hard drives have logical sectors of 512 byte when they 
actually have 4k physical sectors. Here is the document describing what 
to do in such case: 
http://ivoras.net/blog/tree/2011-01-01.freebsd-on-4k-sector-drives.html .

For UFS: newfs -U -f 4096 /dev/da0
For ZFS: gnop create -S 4096 /dev/da0  zpool create data /dev/da0.nop

I am sure most people just install such hard drive without doing this 
and potentially get suboptimal performance since they aren't aware about 
this.
Shouldn't UFS and ZFS drivers be able to either read the right sector 
size from the underlying device or at least issue a warning?


Yuri
___
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: top(1) loses process user time count when threads end

2011-08-06 Thread Yuri

On 08/06/2011 02:11, Alexander Best wrote:

On Fri Aug  5 11, Yuri wrote:

I have the process that first runs in 3 threads but later two active
threads exit.

top(1) shows this moment this way (1 sec intervals):
30833 yuri3  760  4729M  4225M nanslp  4   0:32 88.62% app
30833 yuri3  760  4729M  4225M nanslp  6   0:34 90.92% app
30833 yuri1  960  4729M  4225M CPU11   0:03  1.17% app
30833 yuri1  980  4729M  4226M CPU11   0:04 12.89% app

Process time goes down: 0:34 -  0:03. Also WCPU goes down 90.92% -
1.17% even though this process is CPU bound and does intense things
right after threads exit.

getrusage(2) though, called in the process, shows the correct user time.

I think this is the major bug in the process time accounting.

could you check, whether kern/128177 or kern/140892 describe your situation?


I have ULE scheduler. kern/128177 talks about single thread with ULE 
scheduler, and my issue is with threads. So I am not sure if it is 
related. There have been no motion on kern/128177 since Feb 9, 2009.

kern/140892 is probably the same as mine.

In any case, both these PRs have to be fixed since they are very user 
visible, not just some obscure issues.


Yuri

___
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


top(1) loses process user time count when threads end

2011-08-05 Thread Yuri
I have the process that first runs in 3 threads but later two active 
threads exit.


top(1) shows this moment this way (1 sec intervals):
30833 yuri3  760  4729M  4225M nanslp  4   0:32 88.62% app
30833 yuri3  760  4729M  4225M nanslp  6   0:34 90.92% app
30833 yuri1  960  4729M  4225M CPU11   0:03  1.17% app
30833 yuri1  980  4729M  4226M CPU11   0:04 12.89% app

Process time goes down: 0:34 - 0:03. Also WCPU goes down 90.92% - 
1.17% even though this process is CPU bound and does intense things 
right after threads exit.


getrusage(2) though, called in the process, shows the correct user time.

I think this is the major bug in the process time accounting.

8.2-STABLE

Yuri
___
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


dhclient fails: DHCPNACK rejected

2011-07-27 Thread Yuri

My dhclient session looks like this:

# dhclient re0
DHCPREQUEST on re0 to 255.255.255.255 port 67
DHCPNACK from 192.168.0.1 rejected.
DHCPREQUEST on re0 to 255.255.255.255 port 67
DHCPNACK from 192.168.0.1 rejected.
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 8
DHCPOFFER from 192.168.0.1 rejected.
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 17
DHCPOFFER from 192.168.0.1 rejected.
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 18
DHCPOFFER from 192.168.0.1 rejected.
DHCPDISCOVER on re0 to 255.255.255.255 port 67 interval 9
DHCPOFFER from 192.168.0.1 rejected.

No static lease files present: /var/db/dhclient.leases.*.
dhcpcd has no problem setting up re0 on thisn host.
This happens on the router DLink DIR-601 with the latest firmware.

8.2-STABLE amd64

Yuri

___
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: dhclient fails: DHCPNACK rejected

2011-07-27 Thread Yuri

On 07/27/2011 12:06, Adam Vande More wrote:

Do you have a /etc/dhclient.conf on the box?



Reject statement was there.
Sorry, forgot about this file, it was there for 5 years for unknown reason.

Thank you,
Yuri
___
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


DTrace script asserts and kills the other process

2011-07-22 Thread Yuri

I am trying to run this dtrace script:

#!/usr/sbin/dtrace -s
pid123:libc::entry
{
self-timestmp[probefunc] = timestmp;
}
pid123:libc::return
/self-timestmp[probefunc] != 0/
{
@function_duration[probefunc] = sum(timestmp - self-timestmp[probefunc]);
timestmp[probefunc] = 0;
}

which I got from here:  
http://www.princeton.edu/~unix/Solaris/troubleshoot/dtrace.html

replacing 123 with the pid of some running process.

Result: dtrace utility asserts:
Assertion failed: (dpr != NULL), file  
/usr/src/cddl/lib/libdtrace/../../../cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c, line  
751.

Abort trap: 6

Also the target process is killed too:
Killed: 9

8.2-STABLE amd64

Yuri

___
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


Possible to see which requests are in queue contributing to system load?

2011-07-07 Thread Yuri
top(1) shows the load as a number supposedly equal to the resource queue 
length.
But is there a way to detail this information? For example I want the 
system to log which requests to which files by which process/thread are 
in the queue and when they are fulfilled by the scheduler?


Yuri

___
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


How can process in STOP state consume 200% CPU?

2011-06-28 Thread Yuri
I got VirtualBox process in a strange state. It has the status STOP but 
shows by top as consuming 200% CPU for a very long time.
How is this possible and what does this mean? Process time stays at 0:00 
TIME. kill -9 doesn't kill it.


  PID USERNAME  THR PRI NICE   SIZERES STATE   C   TIMECPU 
COMMAND
 9390 yuri3  440   508M   246M STOP3   0:00 200.00% 
VirtualBox

...

8.2-STABLE

Yuri
___
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: How can process in STOP state consume 200% CPU?

2011-06-28 Thread Yuri

On 06/28/2011 17:24, Sergey Babkin wrote:


(Sorry about quoting, it doesn't always work well from the web client).
Most probably the process is running in an endless loop in the kernel 
mode.
Where it got after entering the STOP state. Remember, the signals are 
processed
only after the process exits from the kernel mode to the user mode, 
and so are the

scheduling states. While it's in the kernel mode, you can't do anything
to it other than use the kernel debugger.


How is this normally possible to make program to loop in kernel mode on 
-STABLE kernel? Doesn't this mean bug in kernel?


Yuri

___
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


Why user time of the process depends on machine load?

2011-06-15 Thread Yuri
When I test performance of the code, I always observe dependency of CPU 
user time on the presence of other CPU intense processes.
Same CPU-only deterministic process that on the quiet machine completes 
in 220 user seconds in the presence of, for example, kde rebuild would 
complete in 261, 266 or even 379 user seconds.
I am talking about times shown by time(1), not actual an execution time. 
It's the same time as getrusage(2) returns in ru_utime field.


Why time that process takes in user seconds depends on what other 
processes are running?


FreeBSD-8.2 STABLE on i7 CPU @ 9200 @ 2.67GHz.

Yuri
___
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


ndis driver presents the valid WiFi network as having the name 0x000000

2011-05-27 Thread Yuri
Underlying card is Broadcom BCM94312MCGSG (mini-card for laptop) with 
Windows driver.
This same card and driver work fine with pretty much any other network I 
tried.

But this one particular network shows as 0x00 and I can't connect to it.
Another FreeBSD desktop with native ath driver and apple both connect to 
it fine.


What might be causing such weird behavior?
Is this a known problem?
Any way to troubleshoot this?

Yuri
___
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: [ECFT] pkgng 0.1-alpha1: a replacement for pkg_install

2011-03-25 Thread Yuri

On 03/25/2011 03:11, Baptiste Daroussin wrote:

Julien Laffaye (jlaffaye@) and I, helped by Philippe Pepiot (huge
contributor) have been working since the end of the last GSoC on a
rewrite of pkg_install.

pkgng is a binary package manager written from scratch for FreeBSD.
   


How does it relate to portmaster and portupgrade packages, which both 
have (or include) supposedly the same functionality?


Yuri
___
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: Is pthread_cond_signal(3) man page correct?

2011-03-17 Thread Yuri

On 03/16/2011 19:20, Garrett Cooper wrote:

So yes, EINTR not being allowed is by design and this backs up what
davidxu@ is stating above. Our manpage just doesn't explicitly call
this requirement out, unlike a Linux manpage I dug up and the
OpenGroup manpage.
   


I apologize for keeping asking, but David Xu mentioned before that 
signal can also be delivered at the same time and pthread_cond_signal 
will exit. Normally its EINTR (like for open(2)). But now you are saying 
that EINTR isn't allowed for pthread_cond_signal. So does this mean that 
signal can't be delivered during pthread_cond_signal, or it will just 
return 0? In the latter case, how can I distinguish signal delivery and 
successful return?


Yuri
___
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: Is pthread_cond_signal(3) man page correct?

2011-03-16 Thread Yuri

On 02/27/2011 18:00, David Xu wrote:

I think in normal case, pthread_cond_signal will wake up one thread,
but other events for example, UNIX signal and fork() may interrupt
a thread sleeping in kernel, and cause pthread_cond_wait to return
to userland, this is called spurious wakeup, and other events, I
can not think of yet, but I believe they exist.
   


Does this mean that pthread_cond_signal can also return EINTR? This 
isn't in pthread_cond_signal(3) either.


Is this the case that all system calls should be assumed to be able to 
return EINTR or only those that have EINTR in their man pages?


Yuri
___
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: Is pthread_cond_signal(3) man page correct?

2011-02-28 Thread Yuri

On 28.02.11 2:41, Pieter de Goeje wrote:

pthread_cond_signal() can indeed wake up more than one thread. That's why you
should always wrap pthread_cond_wait() in a loop. For example a blocking
queue could be implemented like this (pseudo code):


Thank you. Now its clear that POSIX allows multiple wake ups.

But my question is: why would the standard define it this way? Why would 
it allow essentially arbitrary number of waiting threads to be woken up 
by one event? I can't think of any practical app that would need some 
threads to be woken up. It would be natural to expect it to wake 
exactly one thread. So the users won't need to have any special cycles 
like you suggested in your previous post.


What is the underlying reason for POSIX to define it this way and for 
OSes to implement it this way?


Yuri
___
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


Is pthread_cond_signal(3) man page correct?

2011-02-27 Thread Yuri

On FreeBSD-8.1 this page says:
The pthread_cond_signal() function unblocks one thread waiting for the 
condition variable cond.


On Linux it says:
The /pthread_cond_signal/() function shall unblock at least one of the 
threads that are blocked on the specified condition variable /cond/ (if 
any threads are blocked on /cond/).


Also HP page 
(http://docs.hp.com/en/B2355-90130/pthread_cond_signal.3T.html) says: 
If there are no threads blocked on /cond/, this function has no 
effect. And later it says: It is possible that more than one thread 
can be unblocked due to a spurious wakeup.


This is quite confusing: in case nobody is waiting does it block or not? 
In case other threads are waiting it's really any arbitrary number of 
threads are woken up? Or on FreeBSD it's strictly 1? Shouldn't this be 
defined in one and only way by POSIX and all POSIX-compliant systems 
should work exactly the same.


I think man page should be expanded to give more comprehensive explanation.

Yuri
___
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: Is pthread_cond_signal(3) man page correct?

2011-02-27 Thread Yuri

Forwarding to standards@ and davidxu@ per Garrett Cooper suggestion.

Also I want to add that I came to this question while observing behavior 
consistent with multiple wakeup on FreeBSD-8.1. The heavily 
multi-threaded code that assumes that only one thread can be woken up by 
one pthread_cond_signal call crashes, and the only reasonable 
explanation so far is that more than one threads are actually being 
woken up.


Yuri


On 02/27/2011 12:54, Yuri wrote:

On FreeBSD-8.1 this page says:
The pthread_cond_signal() function unblocks one thread waiting for the 
condition variable cond.


On Linux it says:
The /pthread_cond_signal/() function shall unblock at least one of the 
threads that are blocked on the specified condition variable /cond/ 
(if any threads are blocked on /cond/).


Also HP page 
(http://docs.hp.com/en/B2355-90130/pthread_cond_signal.3T.html) says: 
If there are no threads blocked on /cond/, this function has no 
effect. And later it says: It is possible that more than one thread 
can be unblocked due to a spurious wakeup.


This is quite confusing: in case nobody is waiting does it block or 
not? In case other threads are waiting it's really any arbitrary 
number of threads are woken up? Or on FreeBSD it's strictly 1? 
Shouldn't this be defined in one and only way by POSIX and all 
POSIX-compliant systems should work exactly the same.


I think man page should be expanded to give more comprehensive 
explanation.


Yuri
___
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




___
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


FreeBSD ABI?

2011-02-21 Thread Yuri

Where is it documented?
Are there differences with the linux ABI?

Particularly I am interested in stack alignment requirement. For example 
i386 Solaris, Linux and MacOS have 16 bit stack alignment for procedure 
calls. This is reflected in LLVM sources:


  if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || Is64Bit)
stackAlignment = 16;


But FreeBSD is excluded there. Is this a bug in LLVM which magically 
doesn't cause crashes or this is correct and FreeBSD doesn't have 16 bit 
alignment?


Yuri
___
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: FreeBSD ABI?

2011-02-21 Thread Yuri

On 02/21/2011 14:47, b. f. wrote:

Isn't it supposed to [1] conform to:

http://www.sco.com/developers/devspecs/abi386-4.pdf
http://www.x86-64.org/documentation/abi.pdf

?

[1] See, for example:

http://lists.freebsd.org/pipermail/freebsd-hackers/2011-January/034045.html
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/csu/i386-elf/crt1_s.S
http://lists.freebsd.org/pipermail/svn-src-head/2010-December/023065.html
   


Solaris-i386 ABI is also supposed to conform to abi386-4.pdf.
In section 3-10 it says: The stack is word aligned. Although the 
architecture does not require any alignment of the stack, software 
convention and the operating system requires that the stack be aligned 
on a word boundary.
But I know for the fact that Solaris-i386 uses 16 byte alignment. At 
least that's what gcc-4.5.2 thinks when on Solaris.


Still not sure about FreeBSD-i386.

Yuri
___
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: FreeBSD ABI?

2011-02-21 Thread Yuri

On 02/21/2011 15:38, Joerg Sonnenberger wrote:

That's a major difference. The Linux people decided a while ago that
stack alignment should be 16 Byte. GCC effectively forces that down
everyone's throat because until at least GCC 4.2 or 4.3, it can't
correctly realign the stack and just fails miserable. I would be
surprised if it was a conscious decision for the Solaris either.
   


I filed gcc PR asking gcc to revert their behavior back to prescribed by 
documentation: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47842

___
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: FreeBSD ABI?

2011-02-21 Thread Yuri

On 02/21/2011 15:38, Joerg Sonnenberger wrote:

That's a major difference. The Linux people decided a while ago that
stack alignment should be 16 Byte. GCC effectively forces that down
everyone's throat because until at least GCC 4.2 or 4.3, it can't
correctly realign the stack and just fails miserable. I would be
surprised if it was a conscious decision for the Solaris either.
   


On the other hand, 16 byte alignment allows for some extra 
optimizations. For example many SIMD instructions like movdqa can only 
be used on 16 byte aligned values. That's why linux probably decided to 
change this.


Yuri
___
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: Why I can't trace linux process's childs with truss?

2010-09-11 Thread Yuri

On 09/10/2010 16:55, Alexander Kabaev wrote:

You are. ptrace is supported by linuxulator for a while now. The
originator problem is likely because he is trying truss, which is not
Linux-aware. ktrace/linux_kdump combo should work.
   


I tried this: ktrace -d /usr/local/share/skype/skype
Resulting trace again shows only the main process, not it's descendants, 
despite -d flag.

Same in the case of calling with pid: ktrace -d -p pid.

Yuri
___
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


Why I can't trace linux process's childs with truss?

2010-09-10 Thread Yuri
I am trying to get the log of all system calls that skype makes with 
truss -f /usr/local/share/skype/skype
For some reason the resulting log only has the leading process calls and 
nothing from it's 8 childs.
Truss doesn't show any 'cloned' processes. Is this a bug in truss that 
it doesn't follow 'cloned' processes?


Is there any workaround or other way I can debug skype? strace doesn't 
work on amd64.
I am primarily interested why it can't read /dev/video0 device, created 
by webcamd.


Yuri
___
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


  1   2   >