igb drivers and 8.1-RELEASE-p2

2011-10-24 Thread b. nyec
Hi, 
 I hope this is the proper place to ask this question, if not i do apologize.

 a little background, I have a few systems running 8.1-RELEASE-p2 with an Intel 
82575EB Gigabit Card installed. I had a couple of the systems go down with a 
panic: page fault... (igb0 taskq).. I've done some searching and i haven't 
found a solid solution, Doing a PR search for igb i was unable to find a 
solution/patches (http://www.freebsd.org/cgi/query-pr.cgi). No, unfortunately i 
do not have a stack trace/core dump as the systems have not been configured to 
generate the necessary dump information. (yeah, i have considered setting the 
machines properly to generate dumps, and know how, I've considered upgrade 
etc.., call me lazy. heh, i'll save that for a later date as this isn't mission 
critical right now ;) ) I also have 8.2-RELEASE-p2 systems with the same NIC 
installed that have not had any problems. 

So, my question, 
 Is it easily possible to use the igb drivers from 8.2-RELEASE on 8.1-RELEASE 
and load them as a module? If so what would be the best way to accomplish this 
? This is more just a kind of exploration for myself rather than a real fix.

Thanks for any help. 



 
___
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: kexec or similar for FreeBSD

2011-10-24 Thread Russell Cattelan
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

So it has been a while and a lot of hair pulling but
kload is sorta alive and kicking.
It can now load the kernel from userspace, copy it over the running
kernel and jump the the kernel entry point.

I'm still having problems getting through the boot process due
to interrupts arriving for unconfigured handlers.
Fatal Trap (30)

If anybody has some experience with acpi and interrupt configuration in
general and is willing to help please let me know.

- -Russell


On 6/16/11 1:32 PM, Russell Cattelan wrote:
 I have been contacted about possibly implementing a fast reboot 
 mechanism for FreeBSD similar to kexec on Linux.
 
 I have just started looking into how this accomplished so I figured
 a note to freebsd hackers would also be a good place to ask for
 comments.
 
 Has anybody looked at doing something like kexec?
 
 Is it the right thing to do for FreeBSD.  I'm concerned that the 
 way FreeBSD handles early kernel modules (loaded via the boot 
 loader) vs linux which does everything via initrd is going to be a 
 problem.
 
 Thanks for any help on this.
 
 -Russell Cattelan
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6lpnYACgkQNRmM+OaGhBgPHwCfd3hVJh3FTjFYlG9Jl1f9LkMD
7h8Ani6zJbix9UGooippNKhyEapDPRoQ
=r5Sm
-END PGP SIGNATURE-
___
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: _SC_GETPW_R_SIZE_MAX undefined in sysconf.c, what is correct value?

2011-10-24 Thread Christopher J. Ruwe
On Sun, 23 Oct 2011 19:10:34 -0500
Dan Nelson dnel...@allantgroup.com wrote:

 In the last episode (Oct 23), Christopher J. Ruwe said:
  I need to get the maximum size of an pwd-entry to determine the
  correct buffersize for calling getpwnam_r(uname,pwd, buf,
  bufsize, pwdp).  I would like to use sysconf(_SC_GETPW_R_SIZE_MAX)
  to determine bufsize, which unfornutately fails (returns -1).
  Currently, I used 16384, which seems to be too much, bit works for
  the time being.
  
  From recent mails I get that _SC_GETPW_R_SIZE_MAX is not available
  on FreeBSD, e.g.,
  http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2009-September/173081.html
  and
  http://www.redhat.com/archives/libvir-list/2011-May/msg01013.html.
  This assertion seems to be backed
  by /usr/srclib/libc/gen/sysconf.c, line 374.
  
  From Stevens  Rago, Adavanced Programming in the UNIX Environment,
  I can get that FreeBSD supports all possible members in the passwd
  structure, but where can I determine the maximum size of these so
  that I can calculate the ax size of the pwd struct therefrom?  Does
  anybody know or know where to look what maximum size a pwd-entry
  can have?
  
  Knowing the maximum size a pwd structure can have, it seems like to
  be an idea to define the correct value in sysconf.c.  As that is
  not done though suggested in the code, are there any obstacles in
  defining that value so nobody has done that so far?
 
 From looking at the libc/gen/getpwent.c file, it looks like a
 maximum size
 might be 1MB.  The wrapper functions that convert getpw*_r functions
 into ones that simply return a pointer to malloced data all use the
 getpw() helper function, which starts with a 1k buffer and keeps
 doubling its size until the data fits or it hits PWD_STORAGE_MAX
 (1MB).  PWD_STORAGE_MAX is only checked within that getpw() function,
 though, so it's possible that an nss library might return an even
 longer string to a get*_r call.  It's up to you to decide what your
 own limit is :)
 

Uh ... it's just that I hoped I had not to decide ;-)

However, 1M seems to be rather large to me. Let's see (pwd.h):

116 struct passwd {
117 char*pw_name;   /* user name */
118 char*pw_passwd; /* encrypted password */
119 uid_t   pw_uid; /* user uid */
120 gid_t   pw_gid; /* user gid */
121 time_t  pw_change;  /* password change time */
122 char*pw_class;  /* user access class */
123 char*pw_gecos;  /* Honeywell login info */
124 char*pw_dir;/* home directory */
125 char*pw_shell;  /* default shell */
126 time_t  pw_expire;  /* account expiration */
127 int pw_fields;  /* internal: fields filled in */
128 };

So pw_name - MAXLOGNAME (from param.h) = 17. pw_passwd - 
http://www.freebsd.org/doc/handbook/one-time-passwords.html = 129. pw_uid  
pw_gid each sizeof(__uint32_t) ?= 32b. time_t - sizeof(__int64_t) ?= 64b.

At some point, I would just sum it up and reach some size which might be 
machine dependant, but should be somewhere (guessing/estimating now) between 4k 
and 16k. I am short on time just now, am I on the right track or am I missing 
something which should be obvious to someone with experience, but is not to me 
(lacking experience)?

Thanks and regards,
-- 
Christopher J. Ruwe
TZ GMT + 2


signature.asc
Description: PGP signature


Re: _SC_GETPW_R_SIZE_MAX undefined in sysconf.c, what is correct value?

2011-10-24 Thread Dan Nelson
In the last episode (Oct 24), Christopher J. Ruwe said:
 On Sun, 23 Oct 2011 19:10:34 -0500
 Dan Nelson dnel...@allantgroup.com wrote:
  In the last episode (Oct 23), Christopher J. Ruwe said:
   I need to get the maximum size of an pwd-entry to determine the
   correct buffersize for calling getpwnam_r(uname,pwd, buf, bufsize,
   pwdp).  I would like to use sysconf(_SC_GETPW_R_SIZE_MAX) to
   determine bufsize, which unfornutately fails (returns -1).  Currently,
   I used 16384, which seems to be too much, bit works for the time
   being.
[..]
  From looking at the libc/gen/getpwent.c file, it looks like a maximum
  size might be 1MB.  The wrapper functions that convert getpw*_r
  functions into ones that simply return a pointer to malloced data all
  use the getpw() helper function, which starts with a 1k buffer and keeps
  doubling its size until the data fits or it hits PWD_STORAGE_MAX (1MB). 
  PWD_STORAGE_MAX is only checked within that getpw() function, though, so
  it's possible that an nss library might return an even longer string to
  a get*_r call.  It's up to you to decide what your own limit is :)

 Uh ... it's just that I hoped I had not to decide ;-)
 
 However, 1M seems to be rather large to me. Let's see (pwd.h):
 
 116 struct passwd {
 117   char*pw_name;   /* user name */
 118   char*pw_passwd; /* encrypted password */
 119   uid_t   pw_uid; /* user uid */
 120   gid_t   pw_gid; /* user gid */
 121   time_t  pw_change;  /* password change time */
 122   char*pw_class;  /* user access class */
 123   char*pw_gecos;  /* Honeywell login info */
 124   char*pw_dir;/* home directory */
 125   char*pw_shell;  /* default shell */
 126   time_t  pw_expire;  /* account expiration */
 127   int pw_fields;  /* internal: fields filled in */
 128 };
 
 So pw_name - MAXLOGNAME (from param.h) = 17. pw_passwd -
 http://www.freebsd.org/doc/handbook/one-time-passwords.html = 129.  pw_uid
  pw_gid each sizeof(__uint32_t) ?= 32b.  time_t - sizeof(__int64_t) ?=
 64b.
 
 At some point, I would just sum it up and reach some size which might be
 machine dependant, but should be somewhere (guessing/estimating now)
 between 4k and 16k.  I am short on time just now, am I on the right track
 or am I missing something which should be obvious to someone with
 experience, but is not to me (lacking experience)?

The getpwnam_r function needs enough space to store the struct passwd
itself (which has a constant size) plus the strings pointed to by pw_name,
pw_class, pw_gecos, pw_dir, and pw_shell.  If you have enough control over
your environment that you can guarantee that the sum of those strings won't
be larger than 4k, then you can just used a fixed buffer of that size.  Even
1k is probably large enough for 99.999% of all systems.  That's a really
long home directory or shell path :) On the other hand, the GECOS field is
theoretially free-form and could contain a lot of data.  I've never see it
hold more than an office number myself, though.

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


Re: ps -e without procfs(5)

2011-10-24 Thread Mikolaj Golub

On Sun, 16 Oct 2011 20:10:05 +0300 Kostik Belousov wrote:

 KB In my opinion, the way to implement the feature is to (re)use
 KB linprocfs_doargv() and provide another kern.proc sysctl to retrieve the
 KB argv and env vectors. Then, ps(1) and procstat(1) can use it, as well as
 KB procfs and linprocfs inside the kernel.

Thanks! I am testing a patch (without auxv vector so far) and have some
questions.

Original ps -e returns environment only for user owned processes (the access is
restricted by the permissions of /proc/pid/mem file). My kern.proc.env sysctl
does not have such a restriction. I suppose I should add it? What function I
could use for this?

BTW, linprocfs allows to read other user's environment.

 KB While you are at the code, it would be useful to also export the auxv 
vector,
 KB which is immediately before env.

It looks I can find the location of auxv but what about the size? Or do you
propose to extend struct ps_strings to store location and size of auxv? I
could do this way...

-- 
Mikolaj Golub
___
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


Apache Corefile issues

2011-10-24 Thread Mark Saad
Hackers
I have a strange apache issue , and I wonder if anyone has seen this before.
I am running Apache 1.3.34 on freeBSD 7.3-RELEASE amd64 . At some
point in the day apache's children segfault and die. No core files are
generated.  I am
not running mod_php either.

1. I have setup the following sysctls

 #Debug options
 kern.sugid_coredump=1
 kern.corefile=/var/coredumps/%U-%N-%P.core

2. The httpd.conf is set with CoreDumpDirectory /var/coredumps/

3. The dir  /var/coredumps/ is set 1777

4. A ktrace of the parrent apache process shows the core file tries to create


 84954 libhttpd.ep RET   kill 0
 84954 libhttpd.ep CALL  sigreturn(0x7ffeb030)
 84954 libhttpd.ep RET   sigreturn JUSTRETURN
 84954 libhttpd.ep PSIG  SIGSEGV SIG_DFL
 84954 libhttpd.ep NAMI  /var/coredumps/65534-libhttpd.ep-84954.core
 34924 libhttpd.ep RET   select 0
 34924 libhttpd.ep CALL  gettimeofday(0x7fffe890,0)
 34924 libhttpd.ep RET   gettimeofday 0
 34924 libhttpd.ep CALL  fork

5. I  have proc mounted and I can't  gcore -s $PID either

I have no cores and I am stumped .


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


Re: Apache Corefile issues

2011-10-24 Thread Bernd Walter
On Mon, Oct 24, 2011 at 04:52:15PM -0400, Mark Saad wrote:
 Hackers
 I have a strange apache issue , and I wonder if anyone has seen this before.
 I am running Apache 1.3.34 on freeBSD 7.3-RELEASE amd64 . At some
 point in the day apache's children segfault and die. No core files are
 generated.  I am
 not running mod_php either.

Apache 1.x isn't really advised since many many years, but I assume you
have very special reasons to stay with it?

 1. I have setup the following sysctls
 
  #Debug options
  kern.sugid_coredump=1
  kern.corefile=/var/coredumps/%U-%N-%P.core

Don't use quotes here.

 2. The httpd.conf is set with CoreDumpDirectory /var/coredumps/
 
 3. The dir  /var/coredumps/ is set 1777
 
 4. A ktrace of the parrent apache process shows the core file tries to create
 
 
  84954 libhttpd.ep RET   kill 0
  84954 libhttpd.ep CALL  sigreturn(0x7ffeb030)
  84954 libhttpd.ep RET   sigreturn JUSTRETURN
  84954 libhttpd.ep PSIG  SIGSEGV SIG_DFL
  84954 libhttpd.ep NAMI  /var/coredumps/65534-libhttpd.ep-84954.core

It's double quoted here - one to frame the filename and one as part of the
filename itself.
I guess your / directory don't contain a subdirectory named .

  34924 libhttpd.ep RET   select 0
  34924 libhttpd.ep CALL  gettimeofday(0x7fffe890,0)
  34924 libhttpd.ep RET   gettimeofday 0
  34924 libhttpd.ep CALL  fork
 
 5. I  have proc mounted and I can't  gcore -s $PID either
 
 I have no cores and I am stumped .
 
 
 -- 
 mark saad | nones...@longcount.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

-- 
B.Walter be...@bwct.de http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
___
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: question about the exchanges of td-td_lock and mtx in sched_switch() of sched_ule

2011-10-24 Thread Attilio Rao
2011/10/13 Haozhong Zhang snowzh8...@gmail.com:
 Hi,

 I'm recently reading the code of sched_ule in freebsd 8.2.0 and have two
 questions.

 1. sched_switch() (in sched_ule.c) invokes cpu_switch() (at line 1852) and
 thread_unblock_switch() (at line 1867). These two functions exchange
 td-td_lock and mtx. What are the purposes of these exchanges?

 2. Can the exchange in cpu_switch() (in amd64/amd64/cpu_switch.S, at line
 134) be done before calling cpu_switch()? I mean, does this reorder of
 exchange and other operations in cpu_switch() cause side-effects to other
 code?

This thread should have the details you need:
http://lists.freebsd.org/pipermail/svn-src-all/2010-January/019345.html

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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


determining bus_dma memory usage by driver

2011-10-24 Thread Chuck Tuffli
Is there an easy way to determine the amount of bus_dma memory
allocated by a driver? Something similar to vmstat -m

TIA

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


Shrinking 4 parititions on a new HP laptop

2011-10-24 Thread Julian H. Stacey
Hi hackers@
A new purchased HP laptop (pavilion entertainment PC dm3 

http://reviews.shopping.hp.com/8843/dm3t_series/hp-pavilion-dm3t-customizable-notebook-pc-reviews/reviews.htm
had all 4 partitions occupied with Windows 7 Home Prem OA.
(Maybe the shop did that)

I want just 1 of the 4 fdisk partitions with an MS slice (for h/w
test mainly),  the other 3 with FreeBSD slices (2 boots of different
release  a large common UFS as usual. I've done that often before,
not asking for help on that, but normally the PC just uses a single
fdisk partition so it just a case of shrinking it  allocating the
other 3.

This is a bit trickier, I need to figure what all the other partitons
are for,  how to merge/ remove them down to one.

So first I shrank the main NTFS from 223 G to 65G (for now) 
rebooted MS  it still boots MS,

Next I need to copy data from spare Fdisk F1, F3, F4 partitions to main F2,
leaving the others free for FreeBSD ( also I'll need to tell
Fdisk precisely how big my new shrunken F2 NTFS is).

Maybe one of you has insight what the partitions might be for at present ?

It has a 200M F1 active, then F2 is the main MS FS of most of disk.
I wonder why they do that ?
For recovery or repair ?
Or to later allow an encrypted F2 OS booting from another 
smaller F1 OS first ?
I wonder if I can safely merge F1  F2 ?
Then on F3, HP used 12.6 of 15G for their own software as hardware 
manufacturer. (Stuff I'll want to move to F2, cos I need
partitions for BSD) Not sure how I'll move that tree (tar
I guess as I dont know modern MS or trust any MS) (maybe
insert a join command if MS still have that (opposite of
mount, effectively)  to keep the HP seperate yet have paths
under MS working.

Then F4 is taken too,
Backup stuff maybe, or suspend ?

My notes chronologically as I worked:
  --
  MS My Computer says
Local Disk (C:) 176Gig Free of 218   GB
RECOVERY (D:) 2.39 GB Free of   14.5 GB
HP_TOOLS (E:)92.5  MB Free of   99.1 MB
  
  Boot a USB image
  fdisk /dev/ad4
Partition 1 Sysid 7,NTFS etc   199 M Active
start  2048 size407552
Partition 2 Sysid 7,NTFS etc223305 M
start409600 size 457328640
Partition 3 Sysid=7,NTFS etc 14866 M
start 457738240 size  30445568
Partition 4 Sysid 12,DOS/Win-95 32 bit FAT 103 M
start 488183808 size211312
  
  The numbers above add up OK
dc: 2048 407552 + p 409600 457328640 + p 457738240 30445568 + p
488183808 211312 + p 488395120
  
  dmesg announced number of sector for USB da0 but not for ad4.
  dmesg | grep ad4 # 238475 MB WDC WD2500BEKT UDMA100 SATA 3Gb/s
  
  cd /dist/sbin
  kldload /dist/boot/kernel/ntfs.ko
  mount_ntfs/dev/ad4s1 /lap/1 ; du -s -k /lap/1 # 25 M
  mount_ntfs/dev/ad4s2 /lap/2 ; du -s -k /lap/2 # 48.098 M
  mount_ntfs/dev/ad4s3 /lap/3 ; du -s -k /lap/3 # 12,641 M
  mount_msdosfs /dev/ad4s4 /lap/4 ; du -s -k /lap/4 #6.7 M of 101 M
  
  df
1KblocksUsedAvail   Capacity
  s1   203775  28815174960  14%
  s2228664319   43896379 184767940  19% # 
  s3 15222783   12708523   2514260  83% # ./hp/
  s4   101562   6762 94800   7% # ./$RECYCLE.BIN
# ./Hewlett-Packard
  
  Analysis with dc shows F1,F2,F3 fdisk partition entries each 2x512
  bytes more than df shows as size, but with F4, The DOS FS within
  the fdisk partiton is considerably smaller:
  
   203775 2 * p407550   # fdisk shows407552
228664319 2 * p 457328638   # fdisk shows 457328640
 15222783 2 * p  30445566   # fdisk shows  30445568
   101562 2 * p203124   # fdisk shows211312
  
  umount /dev/ad4s2
  /dist/usr/local/sbin/ntfsresize -n -s 65G -v /dev/ad4s2
/libexec/ld-elf.so.1: Shared object libublio.so.1 not found
  
  Discovered make.conf CFLAGS += -static insufficient for sysutils/ntfsprog
  On cross compile host:
file /usr/local/sbin/ntfsresize
/usr/local/sbin/ntfsresize: ELF 64-bit LSB executable,
x86-64, version 1 (FreeBSD), dynamically linked
(uses shared libs), for FreeBSD 8.2, stripped
cd /usr/ports/sysutils/ntfsprogs
unsetenv NOCLEANDEPENDS
make clean
grep -i static /etc/make.conf
CFLAGS += -static  
make
xs make install package
===   ntfsprogs-2.0.0_1 depends on shared library: ublio.1 - 
found
file /usr/local/sbin/ntfsresize
/usr/local/sbin/ntfsresize: 

Re: determining bus_dma memory usage by driver

2011-10-24 Thread Matthew Jacob

On 10/24/2011 5:21 PM, Chuck Tuffli wrote:

Is there an easy way to determine the amount of bus_dma memory
allocated by a driver? Something similar to vmstat -m



bus_dma memory allocations are platform specific. Looking at least amd64 
you can see that the memory is carved out M_DEVBUF.

___
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: determining bus_dma memory usage by driver

2011-10-24 Thread Artem Belevich
On Mon, Oct 24, 2011 at 5:21 PM, Chuck Tuffli ctuf...@gmail.com wrote:
 Is there an easy way to determine the amount of bus_dma memory
 allocated by a driver? Something similar to vmstat -m


Would devinfo -r do?

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