file(9) fix

2015-04-29 Thread Kanonenvogel
The FRELE() macro described in file(9) as void FRELE(), but actually it has return value and it's return value is used by closef(). Index: share/man/man9/file.9 === RCS file: /home/cvsync/openbsd-cvs/src/share/man/man9/file.9,v

replace f_count modifications by FREF() and FRELE()

2015-04-29 Thread Kanonenvogel
FREF() and FRELE() should be used for modify file reference count, so direct f_count modification replaced by their calls. Only one direct f_count decrement was kept in closef() since FRELE() call looks inapplicable here. Index: kern/kern_descrip.c

Re: On github now

2015-04-17 Thread kanonenvogel . 87g
On 17 Apr 2015, at 12:49, Martin Pieuchot m...@openbsd.org wrote: On 16/04/15(Thu) 15:24, kanonenvogel@gmail.com wrote: Well, lets begin. In the future, I wish to have fd_getfile() returning acquired fp instance. The goal is to not to have pointer to destroyed fp instance in FREF

Re: On github now

2015-04-16 Thread kanonenvogel....@gmail.com
Well, lets begin. In the future, I wish to have fd_getfile() returning acquired fp instance. The goal is to not to have pointer to destroyed fp instance in FREF()/FRELE()/fd_getfile() races. This one requres modification of getsock(), getvnode() and dupfdopen() functions, they must receive

Re: File protection, second attempt

2015-04-15 Thread Kanonenvogel
On 15 Apr 2015, at 19:45, Mike Belopuhov m...@belopuhov.com wrote: On 15 April 2015 at 13:29, kanonenvogel@gmail.com kanonenvogel@gmail.com wrote: On 14 Apr 2015, at 18:35, Mike Belopuhov m...@belopuhov.com wrote: Supposedly you don't have to KERNEL_LOCK for pool_{get,put

On github now

2015-04-15 Thread Kanonenvogel
Well, I’ve put /usr/src/sys subtree from 5.7 with my patches on guthub. I would really like to get it more traction on that. https://github.com/Kanonenvogel/openbsd-sys-5.7-smp

Re: File protection, second attempt

2015-04-15 Thread kanonenvogel....@gmail.com
On 14 Apr 2015, at 18:35, Mike Belopuhov m...@belopuhov.com wrote: Supposedly you don't have to KERNEL_LOCK for pool_{get,put} anymore. Underlying uvm calls are not mp safe and not protected by KERNEL_LOCK() calls.

Re: File protection, second attempt

2015-04-12 Thread Kanonenvogel
On 12 Apr 2015, at 21:02, Martin Pieuchot m...@openbsd.org wrote: It's only PoF just for to show my hypothetical roadmap. Can you explain what need to be protected from what? 1. Filelist, nfiles and operations with them are protected by rwlock. Why not, could you describe why they need a

File protection, second attempt

2015-04-12 Thread Kanonenvogel
This is the second attempt of struct file protection. 1. Filelist, nfiles and operations with them are protected by rwlock. 2. Garbage collector's flags FIF_MARK and FIF_DEFER moved from f_iflags to new field f_gc_flags (compatibility with pstat was kept). 3. Operations over f_iflags are atomic.

Re: falloc and related stuff

2015-04-09 Thread kanonenvogel....@gmail.com
Struct file again. f_flag isn’t modified often, so it’s modifacation can be atomic. f_msgcount and f_rxfer, f_wxfer, f_seek, f_rbytes, f_wbytes can be protected by rwlock. f_offset protection is actual for vnodes only. FIF_MARK and FIF_DEFER flags are used only by unpc garbage collector. This

Re: falloc and related stuff

2015-04-08 Thread kanonenvogel....@gmail.com
On 08 Apr 2015, at 02:31, Philip Guenther guent...@gmail.com wrote: On Tue, Apr 7, 2015 at 3:57 PM, Kanonenvogel kanonenvogel@gmail.com wrote: I have idea to modify falloc() function and related logic. Now, after successful faclloc call, we have half-initialized struct file object

Re: falloc and related stuff

2015-04-08 Thread kanonenvogel . 87g
On 08 Apr 2015, at 17:33, kanonenvogel@gmail.com wrote: Is it a good idea? bad idea because of sys_pread

Re: falloc and related stuff

2015-04-08 Thread kanonenvogel....@gmail.com
On 08 Apr 2015, at 17:33, kanonenvogel@gmail.com wrote: Is it a good idea? bad idea because of sys_pread/sys_pwrite

Re: falloc and related stuff

2015-04-08 Thread kanonenvogel....@gmail.com
On 08 Apr 2015, at 15:03, Ted Unangst t...@tedunangst.com wrote: The atomic functions are quite expensive on some architectures, so we don't want to just use them everywhere. So, rwlock is better here? Also, can you explain this lines from finishdup() function (openbsd-5., file

Re: falloc and related stuff

2015-04-08 Thread kanonenvogel....@gmail.com
On 08 Apr 2015, at 15:03, Ted Unangst t...@tedunangst.com wrote: Also, this only helps if you're sure that the code reading the flag will do so in an smp safe way. In many cases, the reading code will also need to acquire a lock in order to correctly do something after reading the flag. From

falloc and related stuff

2015-04-07 Thread Kanonenvogel
Hello. I have idea to modify falloc() function and related logic. Now, after successful faclloc call, we have half-initialized struct file object, protected by FIF_LARVAL flag. I want to initialise struct file object within falloc() and then put it to fd_ofiles array and filehead list. This