Re: looking for decent, current online discussion of user-space drivers

2015-11-17 Thread Robert P. J. Day
On Tue, 17 Nov 2015, Anupam Kapoor wrote:

>
> > [2015-11-17T15:43:52+0530]: "Robert P. J. Day" (rpjday):
> ,[ rpjday ]
> | 
> | in particular, are there any nice examples of this that
> | can be downloaded, built and played with? thanks muchly.
> `
> there is snabbswitch (https://github.com/SnabbCo/snabbswitch) where
> folks have written 82599 (intel-10g card) driver in lua
> (https://github.com/SnabbCo/snabbswitch/tree/master/src/apps/intel)
>
> might be useful...

   h, yes, thanks for the link. just to keep track of what i
collect, i started a new wiki page:

http://www.crashcourse.ca/wiki/index.php/User_space_drivers

i'll add anything else that pops up that looks like it's useful.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: looking for decent, current online discussion of user-space drivers

2015-11-17 Thread Anupam Kapoor

> [2015-11-17T15:43:52+0530]: "Robert P. J. Day" (rpjday):
,[ rpjday ]
| 
| in particular, are there any nice examples of this that
| can be downloaded, built and played with? thanks muchly.
`
there is snabbswitch (https://github.com/SnabbCo/snabbswitch) where
folks have written 82599 (intel-10g card) driver in lua
(https://github.com/SnabbCo/snabbswitch/tree/master/src/apps/intel)

might be useful...

--
kind regards
anupam

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: hi, i want to use a script in kernel

2015-11-17 Thread Valdis . Kletnieks
On Tue, 17 Nov 2015 14:01:19 +0900, Naver said:
> hi,
> i want to use a script in kernel, but i can't use this.
> in my terminal.
> yoon@pc:~/project/aosp/kernel/linux/scripts$ ./checkpatch.pl sortextable.c
> Must be run from the top-level dir. of a kernel tree

$ cd ~/project/aosp/kernel/linux
$ scripts/checkpatch.pl scripts/sortextable.c

Though why you have a .c file in scripts/ is beyond me, it should probably
be in some other directory.


pgp5jfQ19As5r.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: hi, i want to use a script in kernel

2015-11-17 Thread Bogicevic Sasa
On 11/17, valdis.kletni...@vt.edu wrote:
>On Tue, 17 Nov 2015 14:01:19 +0900, Naver said:
>> hi,
>> i want to use a script in kernel, but i can't use this.
>> in my terminal.
>> yoon@pc:~/project/aosp/kernel/linux/scripts$ ./checkpatch.pl sortextable.c
>> Must be run from the top-level dir. of a kernel tree
>
>$ cd ~/project/aosp/kernel/linux
>$ scripts/checkpatch.pl scripts/sortextable.c
>
>Though why you have a .c file in scripts/ is beyond me, it should probably
>be in some other directory.



>___
>Kernelnewbies mailing list
>Kernelnewbies@kernelnewbies.org
>http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
You can use it something like this 
./scripts/checkpatch.pl --file --terse /path/to/the/file.c

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: depmod: ERROR: Found 2 modules in dependency cycles!

2015-11-17 Thread Jim Davis
On Tue, Nov 17, 2015 at 1:09 PM, Lucas Tanure  wrote:
> Hi,
>
> I'm trying to compile and run linux-next tree, but no matter what I do I got
> :
>
> depmod: ERROR: Found 2 modules in dependency cycles!
> depmod: ERROR: Cycle detected: lnet -> libcfs -> lnet
> Makefile:1139: recipe for target '_modinst_post' failed
> make: *** [_modinst_post] Error 1
>
> Can anyone give a way to fix this ?

It looks like you've may have run into a known recent issue with the
lustre modules: https://lkml.org/lkml/2015/11/9/702

Try setting CONFIG_LUSTRE_FS=n.
-- 
Jim

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


looking for decent, current online discussion of user-space drivers

2015-11-17 Thread Robert P. J. Day

  a colleague asks me about the implications of porting a pile of code
from a non-linux embedded OS to linux, and simply rewriting most of it
as user-space drivers, as opposed to a total rewrite to kernel code.
i'm in no way an authority on user-space drivers, so i'm looking for
any decent, up-to-date discussions, not so much on the technical
aspects, but more the *implications* of doing this.

  i'm aware of mmap(), and i'm reading up on UIO, and i've found a few
online pieces that look informative:

http://www.embedded.com/design/operating-systems/4401769/Device-drivers-in-user-space
http://www.enea.com/Documents/Resources/Whitepapers/Enea-User-Space-Drivers-in-Linux_Whitepaper_2013.pdf

so is there something that elaborates on both the pros and cons of
doing this? in particular, are there any nice examples of this that
can be downloaded, built and played with? thanks muchly.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: i want to use the script in kernel script folder.

2015-11-17 Thread Daniel Baluta
On Tue, Nov 17, 2015 at 7:10 AM, 윤영석  wrote:
>
> hi,
> i want to use a script in kernel, but i can't use this.
> in my terminal.
> yoon@pc:~/project/aosp/kernel/linux/scripts$ ./checkpatch.pl sortextable.c
> Must be run from the top-level dir. of a kernel tree

Hi,

You can try ./checkpatch.pl -f --no-tree 

thanks,
Daniel.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


depmod: ERROR: Found 2 modules in dependency cycles!

2015-11-17 Thread Lucas Tanure
Hi,

I'm trying to compile and run linux-next tree, but no matter what I do I
got :

depmod: ERROR: Found 2 modules in dependency cycles!
depmod: ERROR: Cycle detected: lnet -> libcfs -> lnet
Makefile:1139: recipe for target '_modinst_post' failed
make: *** [_modinst_post] Error 1

Can anyone give a way to fix this ? I already re-cloned the tree, tried
different .config files, tried with the stable branch. But nothing works.

Thanks

--
Lucas Tanure
+55 (19) 988176559
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Correctly locking a Block Device Request Handler

2015-11-17 Thread Pranay Srivastava
Hi

On Mon, Nov 16, 2015 at 10:02 PM, Marcel Müller  wrote:
> Hello everyone,
>
> I'm currently writing a block device driver and got stuck at trying to
> understand how to correctly handle the locking
> in the reqfn one passes to `blk_init_queue`.
>
> My code looks like this:
>
> static DEFINE_SPINLOCK(rblk_lock);
>
> /* Code */
>
> static void rblk_request_handler(struct request_queue *q)
> __releases(q->queue_lock) __acquires(q->queue_lock)

as per code, the queue_lock would be held before it enters your
request_func. So no you don't need
to lock it here.

If you must however need to do some stuff that requires the
spin_lock_* to be released, you must
make sure that before you leave this function you have reacquired that lock.

> {
> struct request* req;
> unsigned long flags = 0;
>
> printk(KERN_INFO "rblk: Got request(s) \n");
> while ((req = blk_fetch_request(q)) != NULL) {
> printk(KERN_INFO "rblk: Handling request \n"); // <- Gets
> printed

This isn't required if this is your request_function. Let's say you
just want to consume the requests
but want to actually handle them elsewhere then you may require to
take the spin_lock_* over there.


> spin_lock_irqsave(q->queue_lock, flags);

You are generating error for all requests?

> blk_end_request_all(req, -ENOTTY);
> spin_unlock_irqrestore(q->queue_lock, flags);
> printk(KERN_INFO "rblk: Handled request \n"); // <- Does not
> get printed
> }
> }
>
>
> static in rblk_init() {
> /* Get major number, allocate devices */
> for (i = 0; i < rblk_cnt; i++) { // For each device
> /* alloc_disk, check for allocation fail */
>
> disk->queue = blk_init_queue(rblk_request_handler, _lock);
> }
> }
>
>
> This didn't work, and it was obvious to me that it was hanging in the
> spinlock. So I tried
> removing the locking, (this SO answer says that the queue is already
> locked:
> https://stackoverflow.com/questions/19418979/proper-way-to-lock-the-queue-in-a-block-device-driver-while-serving-requests)
> however, I still get the problem that the queue locks up and the second
> message never hits the message
> queue.
>
> What /does/ work is if I invert the order of locking. As in, unlock
> first, end_request and then lock again.
> However that doesn't seem to be the correct way. What am I doing
> completely wrong, what did I misunderstand?
>
> Full code: https://gist.github.com/TheNeikos/8798788defa1a9f316e6

You can check one here https://github.com/pranjas/block_driver. No
real device though.
>
> Thanks
>
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
---P.K.S

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies