error : insmod

2013-02-11 Thread sunil
hi all,
while inserting module to the linux kernel, m facing this problem
---ERROR-

sunil@ubuntu:~/test/drive$ insmod helloworld.ko
insmod: error inserting 'helloworld.ko': -1 Operation not permitted

sunil@ubuntu:~/test/drive$ sudo modprobe helloworld
FATAL: Module helloworld not found.

please help!!

thanks  regards
Sunil

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


RE: error : insmod

2013-02-11 Thread Ashish_Bunkar
Try it through root access.

Regards
ASHU

-Original Message-
From: kernelnewbies-boun...@kernelnewbies.org 
[mailto:kernelnewbies-boun...@kernelnewbies.org] On Behalf Of sunil
Sent: Monday, February 11, 2013 3:24 PM
To: kernelnewbies@kernelnewbies.org
Subject: error : insmod

hi all,
while inserting module to the linux kernel, m facing this problem
---ERROR-

sunil@ubuntu:~/test/drive$ insmod helloworld.ko
insmod: error inserting 'helloworld.ko': -1 Operation not permitted

sunil@ubuntu:~/test/drive$ sudo modprobe helloworld
FATAL: Module helloworld not found.

please help!!

thanks  regards
Sunil

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

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


Re: error : insmod

2013-02-11 Thread Jeff Kirsher
On 02/11/2013 01:54 AM, sunil wrote:
 hi all,
 while inserting module to the linux kernel, m facing this problem
 ---ERROR-

 sunil@ubuntu:~/test/drive$ insmod helloworld.ko
 insmod: error inserting 'helloworld.ko': -1 Operation not permitted

 sunil@ubuntu:~/test/drive$ sudo modprobe helloworld
 FATAL: Module helloworld not found.

It is a path issue, you need to specify the entire path to helloworld.ko.

For example:

sudo insmod /path/to/your/helloworld.ko



signature.asc
Description: OpenPGP digital signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: error : insmod

2013-02-11 Thread Kristof Provost
On 2013-02-11 15:24:08 (+0530), sunil sunil.slvp...@gmail.com wrote:
 while inserting module to the linux kernel, m facing this problem
 ---ERROR-
 
 sunil@ubuntu:~/test/drive$ insmod helloworld.ko
 insmod: error inserting 'helloworld.ko': -1 Operation not permitted
 
For obvious reasons normal users are not allowed to load kernel modules.
This requires root access (or more accurately, CAP_SYS_MODULE
capabilities). That's why your insmod fails.

 sunil@ubuntu:~/test/drive$ sudo modprobe helloworld
 FATAL: Module helloworld not found.
 
This is a different action from 'insmod helloworld.ko'.

modprobe tries to load the module from /lib/modules/`uname -r`.
It's slightly more convenient because it will also load all modules this
one depends on.

In this case this fails because your module doesn't actually live in
/lib/modules/

Try sudo insmod helloworld.ko instead.

Regards,
Kristof


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


Re: error : insmod

2013-02-11 Thread Kristof Provost
On 2013-02-11 16:10:38 (+0530), sunil sunil.slvp...@gmail.com wrote:
 -output
 sunil@ubuntu:~/test/drive$ sudo insmod ./helloworld.ko
 insmod: error inserting './helloworld.ko': -1 File exists
 
This means you've already loaded the module.

Try 'sudo rmmod helloworld' to unload it first.
This should generate the 'Goodbye, cruel world' dmesg trace.
After that you can load the module again.

Regards,
Kristof

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


Re: error : insmod

2013-02-11 Thread sunil
Hi kristof,

when i executed the below line. i din't get what i suppose to
get...the message hello, world..

did i miss any steps
sunil@ubuntu:~/test/drive$ sudo insmod helloworld.ko


On Mon, Feb 11, 2013 at 4:34 PM, Kristof Provost kris...@sigsegv.be wrote:
 On 2013-02-11 16:24:17 (+0530), sunil sunil.slvp...@gmail.com wrote:
 Have a look at this:

 donno wats happening:

 sunil@ubuntu:~/test/drive$ sudo rmmod helloworld
 sunil@ubuntu:~/test/drive$ lsmod|grep hellow*
 Binary file helloworld.ko matches
 Binary file helloworld.o matches

 This doesn't actually do what you seem to think it does.
 You're not passing the 'hellow*' argument to grep. The 'hellow*' is
 first expaned by your shell, so it probably turns that command line into
 'lsmod | grep helloworld.c helloworld.o helloworld.ko'.
 Try using 'lsmod | grep hellow' instead (i.e. without the *).

 sunil@ubuntu:~/test/drive$ modprobe -r helloworld
 FATAL: Module helloworld not found.

 Obviously, because your previous command succeeded. The module is no
 longer loaded.

 Regards,
 Kristof

 PS: Please don't top-post.
 PS 2: Please keep the mailing list in cc.




-- 

Regards,
Sunil A S

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


Use of copy_to_user() and copy_from_user() functions

2013-02-11 Thread पारस
Hi All,

To read/write data to user-space from kernel-space we use copy_from_user()
and copy_to_user() functions.

What is the use of these function?
Why kernel can't directly access user address and read/write on to it?
Can any one explain why kernel can't directly access the user-space
address.

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


Re: error : insmod

2013-02-11 Thread Kristof Provost
On 2013-02-11 16:50:45 (+0530), sunil sunil.slvp...@gmail.com wrote:
 when i executed the below line. i din't get what i suppose to
 get...the message hello, world..
 
 did i miss any steps
 sunil@ubuntu:~/test/drive$ sudo insmod helloworld.ko
 
The traces you've inserted in your kernel module do not print to stdout.
They get logged in the kernel ring buffer.

Try 'dmesg' after loading your module.

Regards,
Kristof


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


Re: Use of copy_to_user() and copy_from_user() functions

2013-02-11 Thread Mandeep Sandhu
On Mon, Feb 11, 2013 at 4:51 PM, पारस bepa...@gmail.com wrote:
 Hi All,

 To read/write data to user-space from kernel-space we use copy_from_user()
 and copy_to_user() functions.

 What is the use of these function?
 Why kernel can't directly access user address and read/write on to it?
 Can any one explain why kernel can't directly access the user-space address.

There are a lot resources out there which answer this question
adequately in detail (just google for them). I'll give a short answer
here:

'User-space' is essentially a particular process' address space, i.e
the pages (of physical memory) that have been mapped to this process'
virtual memory.
Since pages of virtual memory _might_ be swapped out by the kernel,
one cannot directly transfer data from the kernel memory to the user
mapped memory. For this reason, copy_to/from_user() family of
functions is there, which verify first that the user space address
(pointed to by the user-space pointer) is valid and accessible and
_then_ transfer data to/from it.

If the page corresponding to the address pointed to by the user-space
pointer has been swapped out, the kernel will first swap in that page
and then do the transfer.

CMIIW.

HTH,
-mandeep



 Thanks


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


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


Re: Kernel code interrupted by Timer

2013-02-11 Thread Gaurav Jain
Well, my bad. I was wrong there. Your example was correct. Even in a
multi-kernel like Barrelfish, each core manages only its own share of
memory. RAM is explicitly partitioned between cores running on each kernel
and any data structures that need to be shared across cores have to be
replicated in each of the memory partitions and consistency maintained
through IPC.

~Gaurav


On Fri, Feb 8, 2013 at 10:29 PM, Gaurav Jain gjainroor...@gmail.com wrote:

 I guess you misinterpreted me... A multi-kernel like Barrelfish would have
 separate kernel images running on different cores, but each of the
 core/kernel would be able to address the *entire* physical memory
 (including any memory-mapped devices). Hence, the database would still be
 addressable/reachable from all cores. Traditional locking mechanisms to
 protect the database (like in a single-kernel Linux) would be good here,
 too. OR, like in Barrelfish, we could have explicit inter-core
 communication messages to implement synchronization/consistency.

 ~ Gaurav


 On Fri, Feb 8, 2013 at 9:34 PM, Jeff Haran jeff.ha...@citrix.com wrote:

 Well, for instance what we do. We maintain a big database of cell phone
 user IP addresses and other info in a kernel module running on a 24 core
 X86-64 system. All 24 cores can and do access that data. If each core had
 access to only a single partition of memory, then that DB would have to be
 spread across the various partitions and if the one core that could access
 a specific cell phone user’s info was busy while others were idle, access
 to that user’s would be delayed. The application is quite performance
 sensitive so having the ability for all cores to operate on all data makes
 for better performance.

 ** **

 Jeff

 ** **

 *From:* Gaurav Jain [mailto:gjainroor...@gmail.com]
 *Sent:* Friday, February 08, 2013 11:54 AM

 *To:* Jeff Haran
 *Subject:* Re: Kernel code interrupted by Timer

 ** **

 you can solve problems that can’t be easily solved if all the data is
 partitioned by CPU core.

 ** **

 Can you please give an example or two of the aforementioned problems? I
 can think of efficient scheduling - a single kernel knowing what
 cores/processors are idle would help make better decisions without the
 overhead of message passing in separate kernels on separate cores.

 ** **

 ~Gaurav

 ** **

 On Fri, Feb 8, 2013 at 8:16 PM, Jeff Haran jeff.ha...@citrix.com wrote:
 

 I did not write Linux, so just guessing here. I don’t think the issue is
 so much kernel images as shared access to kernel data. The synchronization
 primitives in the kernel (spin locks, read-write locks, RCU, etc) are there
 to protect data from being corrupted during concurrent access, not code. I
 am not familiar with barrelfish but I think most modern OSes, for instance
 the various BSD derivatives, work like this. I have no recent experience
 with it, but I’d bet Windows does the same thing. If you can run multiple
 cores on the same data safely by providing proper locking, you can solve
 problems that can’t be easily solved if all the data is partitioned by CPU
 core.

  

 Getting the locking right though can be a challenge, which is of course
 good for software engineer job security. 8^)

  

 Jeff

  

 *From:* Gaurav Jain [mailto:gjainroor...@gmail.com]
 *Sent:* Friday, February 08, 2013 11:03 AM
 *To:* Jeff Haran
 *Subject:* Re: Kernel code interrupted by Timer

  

 On multi-core systems this should be done regardless of whether kernel
 pre-emption is enabled or not

  

 -- Do you know why such a design decision was made - That a single kernel
 image should manage all the cores! I have worked on Barrelfish (
 http://www.barrelfish.org/) a bit, and it boots a separate kernel on
 each of the cores. To me that appears to be the more intuitive approach.
 What advantages do we get by having a single kernel image on all cores? Is
 the convenience of being in the same address space (the single kernel's) at
 all cores at all times, the only/major reason? 

  

 ~Gaurav

  

 On Fri, Feb 8, 2013 at 7:51 PM, Jeff Haran jeff.ha...@citrix.com wrote:
 

 I think you will find that this is a matter of kernel configuration. If
 kernel pre-emption is enabled at build time, then following the interrupt
 another process could get scheduled and it wouldn’t matter what interrupt
 went off. Typically some sort of explicit locking or RCU is used to protect
 critical sections in cases like this. On multi-core systems this should be
 done regardless of whether kernel pre-emption is enabled or not.

  

 Jeff Haran

  

 *From:* kernelnewbies-boun...@kernelnewbies.org [mailto:
 kernelnewbies-boun...@kernelnewbies.org] *On Behalf Of *Gaurav Jain
 *Sent:* Friday, February 08, 2013 9:09 AM
 *To:* Kernel Newbies
 *Subject:* Kernel code interrupted by Timer

  

 What happens if the kernel executing in some process context (let's say
 executing 

[PATCH] bind micmute led to capslock led on thinkpads

2013-02-11 Thread Jason A. Donenfeld
Hi folks,

The attached patch binds the capslock light to the micmute light on my
Thinkpad. It works really well.

But it's definitely the wrong way to be doing things. There are two
problems I'd like to solve a better way:

1) How do I find a pointer to the led_device struct for that led, so
that I can call brightness_set on it?
2) How do I hook the kbd_set_leds functions without having to patch atkbd.c?

I'm more interested in (1) than (2), but insights on either would be welcome.

Thanks!

Jason


thinkpad-bind-micmute-led-to-capslock-led.patch
Description: Binary data
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: MAX limit of file descriptor

2013-02-11 Thread Mulyadi Santosa
On Mon, Feb 11, 2013 at 5:07 AM, horseriver horseriv...@gmail.com wrote:


  thanks!

  Actually , my question comes from network performance ,I want to know ,in 
 per second ,the
  maximum of tcp connections that can be dealed with by my server.

AFAIK, the only way to find out is by doing benchmark by your own. You
can use tools like netperf for that purpose.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

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


Re: MAX limit of file descriptor

2013-02-11 Thread Valdis . Kletnieks
On Sat, 09 Feb 2013 13:10:47 +0800, horseriver said:

In one process ,what is the max number of opening file descriptor ?
Can it be set to infinite ?

In network programing ,what is the essential for  the maximum of 
 connections
dealed per second

In general, you'll find that number of file descriptors isn't what ends up
killing you for high-performance network programming.  What usually gets you
are things like syn floods (either intentional ddos or getting slashdotted),
because each time you do an accept() on an incoming connection you end up
using userspace resources to handle the connection.  So the *real* question
becomes how many times per second is your box able to fork() off an httpd,
do all the processing required, and close the connection?

A secondary gotcha is that dying TCP connections end up stuck in FIN-WAIT and
FIN-WAIT-2,

And if you're trying to drive multiple 10G interfaces at line speed, it
gets even more fun.  Fortunately, for my application (high performance disk
servers) the connections are mostly persistent, so it's only a problem of
getting disks to move data that fast. :)



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


Re: MAX limit of file descriptor

2013-02-11 Thread Valdis . Kletnieks
On Mon, 11 Feb 2013 06:07:38 +0800, horseriver said:

  Actually , my question comes from network performance ,I want to know ,in 
 per second ,the
  maximum of tcp connections that can be dealed with by my server.

That will be *highly* dependent on what your server code does with each 
connection.
A hello world reply and close socket will, of course, go lots faster than
something that has to go contact an enterprise-scale database, do 3 SQL joins,
and format the results.

  How can I do the test and calculate the connection  number , Is it possible 
 that my server
  can deal with 10k tcp connections per second?

10K/sec peaks can be achieved even on a laptop, assuming a dummy do-nothing
service.  Keeping that sustained for a real application will depend on the
service time needed - if you have 20 CPUs in the box, and spread the load
across all 20, you have to average under 2ms to service each request, which
will be a killer if you have to go to disk at all for a request.  At that
point, the guys at Foundry will be more than happy to sell you a load-balancer
so you can have a stack of 10 20-CPU servers each of which only handles 1K/sec
and thus has a 20ms time budget.

  what is the relationship between this and throughput rate?

Lots of tiny connections will totally suck at aggregate throughput, if for no
other reason than TCP slow-start never gets a chance to really open the
transmit window up.  But in general, there is always a trade-off
between transaction rate and throughput.

  Is there document that tells the best optimization of this ?

best is defined by what your application actually needs.  The best
settings for my NFS server will be totally different than what the HTTP
server 12 racks over needs...



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


Re: Use of copy_to_user() and copy_from_user() functions

2013-02-11 Thread Chetan Nanda
On Mon, Feb 11, 2013 at 5:25 PM, anish singh anish198519851...@gmail.comwrote:



 On Mon, Feb 11, 2013 at 4:51 PM, पारस bepa...@gmail.com wrote:
  Hi All,
 
  To read/write data to user-space from kernel-space we use
 copy_from_user()
  and copy_to_user() functions.
 
  What is the use of these function?
  Why kernel can't directly access user address and read/write on to it?
 what will happen if the user space process gets scheduled out while
 you were using it?

 copy_to/from_user should always be called from process context. So even if
a process is scheduled out there is not impact, as when process schedule
back in copying will resume to/from correct page.


  Can any one explain why kernel can't directly access the user-space
 address.
 
  Thanks
 
 
  ___
  Kernelnewbies mailing list
  Kernelnewbies@kernelnewbies.org
  http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
 


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


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


Re: Use of copy_to_user() and copy_from_user() functions

2013-02-11 Thread anish singh
On Tue, Feb 12, 2013 at 9:24 AM, Chetan Nanda chetanna...@gmail.com wrote:



 On Mon, Feb 11, 2013 at 5:25 PM, anish singh anish198519851...@gmail.com 
 wrote:



 On Mon, Feb 11, 2013 at 4:51 PM, पारस bepa...@gmail.com wrote:
  Hi All,
 
  To read/write data to user-space from kernel-space we use copy_from_user()
  and copy_to_user() functions.
 
  What is the use of these function?
  Why kernel can't directly access user address and read/write on to it?
 what will happen if the user space process gets scheduled out while
 you were using it?

 copy_to/from_user should always be called from process context. So even if a 
 process is scheduled out there is not impact, as when process schedule back 
 in copying will resume to/from correct page.
because page fault will be triggered and the user space will be swapped in.
 That answers the original question.

  Can any one explain why kernel can't directly access the user-space 
  address.
 
  Thanks
 
 
  ___
  Kernelnewbies mailing list
  Kernelnewbies@kernelnewbies.org
  http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
 


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



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


Re: MAX limit of file descriptor

2013-02-11 Thread michi1
Hi!

On 14:24 Mon 11 Feb , valdis.kletni...@vt.edu wrote:
 On Sat, 09 Feb 2013 13:10:47 +0800, horseriver said:
...
 In network programing ,what is the essential for  the maximum of 
  connections
 dealed per second
 ...
 So the *real* question
 becomes how many times per second is your box able to fork() off an httpd,
 do all the processing required, and close the connection?

If you fork(), than this definitely will be your bottleneck (except the
application does something even slower). Better use epoll+nonblocking i/o.

-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com

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