Huge difference in build sizes

2014-12-02 Thread Raghavendra
Hello all,

I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this, 
I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's 
configuration, and the compiler which came with the distro. I've noticed 
that there is a huge difference in the size of the .ko file between the 
Ubuntu's kernel and the kernel which I've compiled. Sample results are :

$ du -sh usb-storage.ko
It shows : 56K for the Ubuntu's 3.2 kernel
 1.3M for the custom kernel that I've compiled

I've tested the same thing for a simple hello world module :
$ du -sh hello.ko
It shows : 4.0k for the Ubuntu's 3.2 kernel
 56k for the custom kernel that I've compiled

What could be the reason for this huge amount of difference of storage 
space in spite of using the same config file and compiler?

Thanks in advance.

Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: Huge difference in build sizes

2014-12-02 Thread Raghavendra
Hello Tinti,

Thank you for the reply.

On Tuesday 02 December 2014 05:21 PM, Vinícius Tinti wrote:
 On Tue, Dec 2, 2014 at 7:08 AM, Raghavendra ar...@cdac.in wrote:
 Hello all,

 I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this,
 I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's
 configuration, and the compiler which came with the distro. I've noticed
 that there is a huge difference in the size of the .ko file between the
 Ubuntu's kernel and the kernel which I've compiled. Sample results are :

 $ du -sh usb-storage.ko
 It shows : 56K for the Ubuntu's 3.2 kernel
   1.3M for the custom kernel that I've compiled

 I've tested the same thing for a simple hello world module :
 $ du -sh hello.ko
 It shows : 4.0k for the Ubuntu's 3.2 kernel
   56k for the custom kernel that I've compiled

 What could be the reason for this huge amount of difference of storage
 space in spite of using the same config file and compiler?
 Are you sure that you have build with the same optimization flags?

 I guess that -O2 is missing in the big example. Could you double check?
Actually, I haven't use any optimization flags. I've just hit 'make' 
from the command line while compiling for both the kernels. I even 
checked the Makefile of both the kernels. -O2 flag is used in the same 
way in both the Makefiles.

Regards,
Raghavendra

 Regards

 Thanks in advance.

 Raghavendra

 ---
 [ C-DAC is on Social-Media too. Kindly follow us at:
 Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

 This e-mail is for the sole use of the intended recipient(s) and may
 contain confidential and privileged information. If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies and the original message. Any unauthorized review, use,
 disclosure, dissemination, forwarding, printing or copying of this email
 is strictly prohibited and appropriate legal action will be taken.
 ---


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


---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: Huge difference in build sizes

2014-12-02 Thread Raghavendra
Hello Greg,

Thank you for the reply.

On Tuesday 02 December 2014 11:46 PM, Greg KH wrote:
 On Tue, Dec 02, 2014 at 02:38:27PM +0530, Raghavendra wrote:
 Hello all,

 I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this,
 I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's
 configuration, and the compiler which came with the distro. I've noticed
 that there is a huge difference in the size of the .ko file between the
 Ubuntu's kernel and the kernel which I've compiled. Sample results are :

 $ du -sh usb-storage.ko
 It shows : 56K for the Ubuntu's 3.2 kernel
   1.3M for the custom kernel that I've compiled

 I've tested the same thing for a simple hello world module :
 $ du -sh hello.ko
 It shows : 4.0k for the Ubuntu's 3.2 kernel
   56k for the custom kernel that I've compiled

 What could be the reason for this huge amount of difference of storage
 space in spite of using the same config file and compiler?
 You have not stripped the debug symbols from the kernel you built,
 which is what Ubuntu does as part of their build process.  I suggest
 turning off that kernel configuration option, as it's probably not
 needed for your development.
If you are referring to the option CONFIG_DEBUG_INFO, then it is said 
to 'y' in both the kernel's configuration files.
Is there any other config. option or compiler flags that I need to look for?

 Hope this helps,

 greg k-h
Thanks,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: Huge difference in build sizes

2014-12-02 Thread Raghavendra
On Wednesday 03 December 2014 09:45 AM, Greg KH wrote:
 On Wed, Dec 03, 2014 at 09:26:34AM +0530, Raghavendra wrote:
 Hello Greg,

 Thank you for the reply.

 On Tuesday 02 December 2014 11:46 PM, Greg KH wrote:
 On Tue, Dec 02, 2014 at 02:38:27PM +0530, Raghavendra wrote:
 Hello all,

 I am using Ubuntu-12.04 which came with 3.2 kernel. Parallel to this,
 I've compiled and installed 3.12.1 kernel using the Ubuntu-3.2's
 configuration, and the compiler which came with the distro. I've noticed
 that there is a huge difference in the size of the .ko file between the
 Ubuntu's kernel and the kernel which I've compiled. Sample results are :

 $ du -sh usb-storage.ko
 It shows : 56K for the Ubuntu's 3.2 kernel
   1.3M for the custom kernel that I've compiled

 I've tested the same thing for a simple hello world module :
 $ du -sh hello.ko
 It shows : 4.0k for the Ubuntu's 3.2 kernel
   56k for the custom kernel that I've compiled

 What could be the reason for this huge amount of difference of storage
 space in spite of using the same config file and compiler?
 You have not stripped the debug symbols from the kernel you built,
 which is what Ubuntu does as part of their build process.  I suggest
 turning off that kernel configuration option, as it's probably not
 needed for your development.
 If you are referring to the option CONFIG_DEBUG_INFO, then it is said to
 'y' in both the kernel's configuration files.
 Is there any other config. option or compiler flags that I need to look for?
 That's a good one to turn off, start with that and see what happens.

Yeah, I turned off the config option and compared the sizes. Now, both 
result in the same build size. Thanks for the suggestion Greg. Still, my 
concern is that the distro's build is generating a small build size in 
spite of having the option 'CONFIG_DEBUG_INFO' set to 'y'. Any thoughts?

Thanks,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


KGPU : any scope?

2014-12-01 Thread Raghavendra
Hello all,

I was going through the concept of KGPU, which is a GPU computing 
framework for the Linux Kernel. I've read the white paper on it(can be 
found at http://www.cs.utah.edu/~wbsun/kgpu.pdf) and I am very much 
interested in this project, but what could be the scope of 
this(although, the paper mentions a few application areas like crypto, 
networking, fs, etc)? Does the kernel really require GPU's assistance? 
What is the scope of building kernel frameworks around it?

Also the current framework is build using CUDA. I want to re-implement 
the same using OpenCL as it is supported by most of the GPUs. As per my 
perspective, I see a huge learning opportunity here. But, practically 
how fas is it useful?

Any suggestions would be helpful.

Thanks

Raghavendra.

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: Debug Kernel Modules With KGDB

2014-12-01 Thread Raghavendra

On Monday 01 December 2014 03:26 PM, Freeman Zhang wrote:

Hi list,

I've been trying to setup a debug environment for linux
kernel(v3.4,Android,ARM) with kgdb. It worked fine untill I tried to use
it to debug a module. Under the instruction from LDD, I add module debug
info in gdb with command:

add-symbol-file test-module.ko  address

LDD uses `cat /sys/module/test-module/sections/.text` to get the address
where the module has been loaded. However, I got:

0x

Try reading the file as a root.
$ sudo cat /sys/module/test-module/sections/.text


When I use `lsmod`, I got:

test-module 15278 0 - Live 0x (O)

Why nothing but 0x ??

So I have to do some research in kernel/module.c, and find out that
struct module - module_core = 0xbf00. But when I try these in gdb:

add-symbol-file test-module.ko  0xbf00
break one_of_my_function

I got:

Cannot access memory at address 0xbf002350

:(
Could somebody help?


All the best!
Freeman Zhang







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



---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---

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


Re: [eudyptula] has anyone received a gift after completing the challenge ?

2014-12-01 Thread Raghavendra
On Monday 01 December 2014 04:03 PM, Vinícius Tinti wrote:
 On Mon, Dec 1, 2014 at 1:54 AM, Raghavendra ar...@cdac.in wrote:
 On Friday 28 November 2014 02:52 PM, Denis Pithon wrote:

 Hi all,

 I have finished the challenge some month ago and wonder if somebody has
 received something from the Linux Foundation ? :-)
 Thanks

 Denis


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

 Hi Denis,

 Same here. I've finished the challenge in the first week of October. At the
 end they have asked for the mailing address, and so I gave them. But, I
 haven't received any further intimation from them.

 Regards,
 Raghavendra

 ---
 [ C-DAC is on Social-Media too. Kindly follow us at:
 Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

 This e-mail is for the sole use of the intended recipient(s) and may
 contain confidential and privileged information. If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies and the original message. Any unauthorized review, use,
 disclosure, dissemination, forwarding, printing or copying of this email
 is strictly prohibited and appropriate legal action will be taken.
 ---
 Hi Raghavendra,

 Congrats! How long did it take?
 I am still waiting task05 answer.

 Regards.
 Tinti

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



Hi Tinti,

Well, I registered for the challenge on 24th April,14 and I received the 
final task's results on 3rd October,14. So, I may say about 5-6 months. 
But I see that the current responses have become even slower than before :(

Any way, all the best for your remaining tasks.

Regards,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: Debug Kernel Modules With KGDB

2014-12-01 Thread Raghavendra
Hi Zhang,

On Monday 01 December 2014 04:32 PM, Freeman Zhang wrote:
 Hi Raghavendra,

 Thanks for your reply, but `sudo` doesn't solve the problem :(
Well then I guess 'sudo' isn't implemented in android. Any way, 
ultimately you may wan't to login as root and then try reading the file 
in order to get the address.
Regards,
Raghavendra

 All the best!

 Freeman Zhang

  Original Message 
 On Monday 01 December 2014 03:26 PM, Freeman Zhang wrote:
 Hi list,

 I've been trying to setup a debug environment for linux
 kernel(v3.4,Android,ARM) with kgdb. It worked fine untill I tried to use
 it to debug a module. Under the instruction from LDD, I add module debug
 info in gdb with command:

  add-symbol-file test-module.ko  address

 LDD uses `cat /sys/module/test-module/sections/.text` to get the address
 where the module has been loaded. However, I got:
  
  0x
 Try reading the file as a root.
 $ sudo cat /sys/module/test-module/sections/.text
 When I use `lsmod`, I got:

  test-module 15278 0 - Live 0x (O)

 Why nothing but 0x ??

 So I have to do some research in kernel/module.c, and find out that
 struct module - module_core = 0xbf00. But when I try these in gdb:

  add-symbol-file test-module.ko  0xbf00
  break one_of_my_function

 I got:

  Cannot access memory at address 0xbf002350

 :(
 Could somebody help?


 All the best!
 Freeman Zhang

  
  




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

 ---

 [ C-DAC is on Social-Media too. Kindly follow us at:
 Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

 This e-mail is for the sole use of the intended recipient(s) and may
 contain confidential and privileged information. If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies and the original message. Any unauthorized review, use,
 disclosure, dissemination, forwarding, printing or copying of this email
 is strictly prohibited and appropriate legal action will be taken.
 ---





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



---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: [eudyptula] has anyone received a gift after completing the challenge ?

2014-11-30 Thread Raghavendra

On Friday 28 November 2014 02:52 PM, Denis Pithon wrote:

Hi all,

I have finished the challenge some month ago and wonder if somebody 
has received something from the Linux Foundation ? :-)

Thanks

Denis


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

Hi Denis,

Same here. I've finished the challenge in the first week of October. At 
the end they have asked for the mailing address, and so I gave them. 
But, I haven't received any further intimation from them.


Regards,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---

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


Re: How can I wake up one process from the wait queue?

2014-10-30 Thread Raghavendra

On Thursday 30 October 2014 02:02 PM, Rock Lee wrote:


Hi, everyone

I am implementing a simple driver to experiment with wait queue.Two or 
more read processes block until a write process changes a flag and 
call wake_up_interruptible().I expect that a write process will only 
wake up one read process.However, once a write process calls 
wake_up_interruptible() , all the read processes are awaken. How can I 
wake up one process from the wait queue?


You can use exclusive wait queues, which wakes up only one process from 
the queue.


Although the general idea that is followed is: all the process are woken 
up once the resource is made available. And then the access to that 
resource is guarded by a lock, which in turn allows only one process to 
access the resource. Rest of the processes are pushed backed to sleep(or 
busy wait).


---
[ C-DAC is on facebook. Kindly follow us on the following url:  
https://www.facebook.com/CDACINDIA ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---

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


Re: booting kernel with kvm

2014-10-15 Thread Raghavendra

Hello,
On Wednesday 15 October 2014 03:01 PM, harisha ja wrote:


Hi All,

I am interested in Linux kernel development. I have subscribed for 
newbies mail for a while and this is my first mail to the group. My 
intention and interest is to work on network( if possible mm) side of 
kernel. First of all thanks for all the kernel developers and the guys 
here for contribution to Linux community.


Here is my doubt.

1) I downloaded the linux source code and created the config using 
make defconfig and created image using make ( I did not do make 
install as I want test it with kvm)


I have windows 7 system and I have installed ubuntu using vmware. I 
have installed KVM on ubuntu and I am trying to boot the kernal image 
with KVM. But I am not sure what is the problem. I am stuck in this 
screen. Is something I am missing here?


The approach using kvm to put some logs and to see module 
initialization is wrong?.


The command I am using
kvm  -kernel ./arch/x86/boot/bzImage  -append root=/root/
Along with the kernel, you must also specify the file system image. A 
simple invoking of the command could be something like this :

$ kvm -hda file_system.img -kernel bzImage -append root=/dev/sda1



I see the below message and then the qemu prompt does not boot and 
stops by displaying below traceback.


|Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory|

That's fine. QEMU uses something called as tcg accelerator to get the 
job done.



QEMU
5.1654731 Stack: 5.1654731 c18ea844 claea9a0  fffa 
d?861efc 8001 d?8611 a35f91 5.1654731 cl8ddba8 d?861efc d7861efc 
fffa  d7b6e000 cl8dd6 ff3dc0 5.1654731 d7b6e000 6e6b6e75 
2d6e??61 636f 6c62 2c30286b c1002930 d78611 13c248 5.1654731

Call Trace:
5.1654731 lc1a35f911 mount_block_root+Ox158/0x1de
5.1654731 lc10029301 ? do_general_protection+0x40/0x170
5.1654731 lc113c2481 ? SyS_mknod+0x28/0x30
5.1654731 lcla3610a1 mount_root+Oxf3/Oxfb
5.1654731 lc1a362351 prepare_namespace+0x123/0x167
5.1654731 lc112cf30l ? SyS_access+0x20/0x30
5.1654731 lcla35cf71 kernel_init_freeable+Ox1b5/0x1c2
5.1654731 lc1a355451 ? do_early_param+0x74/0x74
5.1654731 lc174caab1 kernel_init+Oxb/Oxe0
5.1654731 lc175a0411 ret_from_kernel_thread+0x21/0x30
5.1654731 lc174caa01 ? rest_init+0x60/0x60
5.1654731 Code: 00 00 00 00 31 ff 83 3d 8c a9 ae cl 00 74 05 e8 Oe dO 
9 c? 44 24 04 a0 a9 ae cl c7 04 24 44 a8 Be cl e8 b6 05 00 00 fb 3116 
351 15 83 75 f0 01 8b 45 f0 ff 15 80 a9 ae cl 01 c6 8d be 5.1654731 
EIP: lc174f2e91 panic+0x165/0x197 SS:ESP 0068:d7861eb8 5.1654731 --I 
end trace a4Obaf277b417d8d 1--
This is probably because of the file system issue that I've mentioned 
previously.







Thanks
Harish



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


Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---

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


Re: booting kernel with kvm

2014-10-15 Thread Raghavendra


On 15/10/2014 11:27 PM, harisha ja wrote:

Hi Raghavendra,

Thanks for your response.

Yes that was an issue and I corrected it. But I see kvm is trying to 
boot the kernel and I still see those tracebacks and it does not do 
anything after that. It is not giving back the console.


That is because you are trying to boot a system without providing the 
root file system.
You could get a simple non-GUI based file systems if you just search for 
it, else you could build your own and then try launching QEMU.



Some commands I executed

linux/linux_ws$ sudo modprobe kvm-intel
FATAL: Error inserting kvm_intel 
(/lib/modules/3.11.0-15-generic/kernel/arch/x86/kvm/kvm-intel.ko): 
Operation not supported

rama@ubuntu:~/linux/linux_ws$


First of all, the underlying hardware, which in your case is VmWare box, 
has to support that!


rama@ubuntu:~/linux/linux_ws$ egrep '^flags.*(vmx|svm)' /proc/cpuinfo
rama@ubuntu:~/linux/linux_ws$



The modified command

qemu-system-x86_64 -kernel  ./arch/x86/boot/bzImage -append 
root=/dev/sda


This is my printf which I am expecting to see using dmsg after kernel 
bootup. Am I missing something here?


rama@ubuntu:~/linux/linux_ws$ git diff
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c 
b/drivers/net/ethernet/intel/e1000/e1000_main.c

index cbc330b..3063991 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -937,7 +937,7 @@ static int e1000_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)

struct net_device *netdev;
struct e1000_adapter *adapter;
struct e1000_hw *hw;
-
+
static int cards_found = 0;
static int global_quad_port_a = 0; /* global ksp3 port a 
indication */

int i, err, pci_using_dac;
@@ -945,7 +945,8 @@ static int e1000_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)

u16 tmp = 0;
u16 eeprom_apme_mask = E1000_EEPROM_APME;
int bars, need_ioport;
-
+
+   printk(KERN_DEBUG I can modify the Linux kernel!\n);
/* do not allocate ioport bars when not needed */
need_ioport = e1000_is_need_ioport(pdev);
if (need_ioport) {


Ok, first of all, what Paul suggested is absolutely right. You can't get 
through the kernel log for a KERN_DEBUG(except for changing some make 
options and all). Try using dev_info().


The next thing I see is that, you are printing in the driver's probe 
function, which would not be called unless a matching hardware is found.

While launching kvm itself, you have you provide the hardware as well.

So, your complete setup should be something like this.
1) Download a file system image(or make your own). Lets call this 
rootfs.img

2) Compile the driver, e1000 as a part of linux(not as a module).
3) While launching QEMU, provide an option to emulate the e1000 device 
as well.

4) Launch qemu as :

$ qemu-system-x86 -hda rootfs.img -kernel bzImage -append 
root=/dev/sda1 -net nic,model=e1000





Thanks and Regards,
Harisha


Hope this helps.

Raghavendra






On Wed, Oct 15, 2014 at 3:53 PM, Raghavendra ar...@cdac.in 
mailto:ar...@cdac.in wrote:


Hello,
On Wednesday 15 October 2014 03:01 PM, harisha ja wrote:


Hi All,

I am interested in Linux kernel development. I have subscribed
for newbies mail for a while and this is my first mail to the
group. My intention and interest is to work on network( if
possible mm) side of kernel. First of all thanks for all the
kernel developers and the guys here for contribution to Linux
community.

Here is my doubt.

1) I downloaded the linux source code and created the config
using make defconfig and created image using make ( I did not do
make install as I want test it with kvm)

I have windows 7 system and I have installed ubuntu using vmware.
I have installed KVM on ubuntu and I am trying to boot the kernal
image with KVM. But I am not sure what is the problem. I am stuck
in this screen. Is something I am missing here?

The approach using kvm to put some logs and to see module
initialization is wrong?.

The command I am using
kvm  -kernel ./arch/x86/boot/bzImage  -append root=/root/

Along with the kernel, you must also specify the file system
image. A simple invoking of the command could be something like this :
$ kvm -hda file_system.img -kernel bzImage -append root=/dev/sda1



I see the below message and then the qemu prompt does not boot
and stops by displaying below traceback.

|Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory|


That's fine. QEMU uses something called as tcg accelerator to get
the job done.



QEMU
5.1654731 Stack: 5.1654731 c18ea844 claea9a0  fffa
d?861efc 8001 d?8611 a35f91 5.1654731 cl8ddba8 d?861efc
d7861efc fffa  d7b6e000 cl8dd6 ff3dc0 5.1654731
d7b6e000

Issue while reading from tty driver

2014-09-18 Thread Raghavendra
Hello,

I am trying to explore tty drivers. To start with, I am trying to 
implement a simple loop back device(testing with echo and cat).

The code works fine as far as write is concerned. When the user process 
(echo) calls write() on the device, the driver's write_room() is called 
and then write() is being called successfully. After which, the 
flush_chars() function is being called, in which, a work is scheduled to 
resend the data back to the user space. I have used the 
tty_insert_flip_char() and tty_flip_buffer_push() to get the job done. 
But it is so happening that the read process (cat) is blocking. What 
might be the reason for this blocking?

My code could be found here : 
https://github.com/raghav3276/tty_test/blob/master/tty_test.c

The code is written by taking a reference from LDD3, TTY drivers.
I am implementing the driver on Linux-3.12.1 and I have seen that the 
approach has changed slightly!

Also I have a few more questions regarding the flow of data :
1) During write process, I see that the write is being called twice. In 
the first call, the 'actual' data is being transferred until a new line 
is encountered and in the next call, two new lines are being 
transmitted. So is there any specific format for the data that is to be 
passed to the write() function? Is it mandatory to terminate the data 
with new line or NULL or anything else?
2) Is there any criteria that is to be satisfied to support the read 
functionality as the process that is trying to read the data is blocked? 
Any specific flags or minimum buffer count, etc?

Thanks,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: DMA over USB

2014-07-02 Thread Raghavendra
On Wednesday 02 July 2014 11:02 AM, Greg KH wrote:
 On Tue, Jul 01, 2014 at 10:29:39PM -0700, Greg KH wrote:
 On Wed, Jul 02, 2014 at 10:40:21AM +0530, Raghavendra wrote:
 Hello,

 I have a query regarding DMA(Direct Memory Access) for the usb devices.

 The understanding of DMA actions over PCI is straight forward. PCI
 devices support bus mastering capability, such that the PCI devices
 could take the ownership of the bus and perform access to the memory
 directly, and a software support exists for the same in Linux.

 As far as USB devices are concerned, they don’t have the bus mastering
 capability like the PCI devices.
 But the USB URB structure have a field named 'dma_addr_t transfer_dma',
 used for DMA access. The USB driver allocate the DMA buffers coherently
 and pass the DMA address to the URBs during its initialization.
 As far as Linux is concerned, how the DMA action being taking place for
 USB devices. As per my understanding, the USB host controller is taking
 care of the DMA operations. But I require a little more insight into it.
 Why, what exactly are you concerned about?  What are you trying to do?
 Also, you _have_ read the USB DMA documentation, right?

 What about the documentation in this area is unclear?
Yes, I have read the documentation and its fine. I am mostly concerned 
about the all the heavy lifting happening in the background.

 thanks,

 greg k-h

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



---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: DMA over USB

2014-07-02 Thread Raghavendra
On Wednesday 02 July 2014 11:42 AM, Greg KH wrote:
 On Wed, Jul 02, 2014 at 11:32:47AM +0530, Raghavendra wrote:
 On Wednesday 02 July 2014 11:02 AM, Greg KH wrote:
 On Tue, Jul 01, 2014 at 10:29:39PM -0700, Greg KH wrote:
 On Wed, Jul 02, 2014 at 10:40:21AM +0530, Raghavendra wrote:
 Hello,

 I have a query regarding DMA(Direct Memory Access) for the usb devices.

 The understanding of DMA actions over PCI is straight forward. PCI
 devices support bus mastering capability, such that the PCI devices
 could take the ownership of the bus and perform access to the memory
 directly, and a software support exists for the same in Linux.

 As far as USB devices are concerned, they don’t have the bus mastering
 capability like the PCI devices.
 But the USB URB structure have a field named 'dma_addr_t transfer_dma',
 used for DMA access. The USB driver allocate the DMA buffers coherently
 and pass the DMA address to the URBs during its initialization.
 As far as Linux is concerned, how the DMA action being taking place for
 USB devices. As per my understanding, the USB host controller is taking
 care of the DMA operations. But I require a little more insight into it.
 Why, what exactly are you concerned about?  What are you trying to do?
 Also, you _have_ read the USB DMA documentation, right?

 What about the documentation in this area is unclear?
 Yes, I have read the documentation and its fine. I am mostly concerned about
 the all the heavy lifting happening in the background.
 Why?  What exactly are you concerned about?  What hardware controller?
 Is something not working properly?
Everything is fine. This is more of a theoretical understanding.

 greg k-h


---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: DMA over USB

2014-07-02 Thread Raghavendra
On Wednesday 02 July 2014 11:05 AM, Chan Kim wrote:
 Hi Raghavendra,
 In my case, we used USB host design from opencore. And the driver (I don't 
 know where it came from. it's similar to sl811-hcd.c from cypress) writes or 
 reads the data to /from the USB host. Not using DMA. I think if the USB host 
 has DMA capability, tha pio read/write should be chnaged to triggering DMA.
 http://lxr.free-electrons.com/source/drivers/usb/host/sl811-hcd.c  see line 
 234.
 Chan



 보낸 사람 : Raghavendra ar...@cdac.in
 보낸 날짜 : 2014-07-02 14:20:42 ( +09:00 )
 받는 사람 : kernelnewbies Kernelnewbies@kernelnewbies.org
 참조 : 
 제목 : DMA over USB

 Hello,

 I have a query regarding DMA(Direct Memory Access) for the usb devices.

 The understanding of DMA actions over PCI is straight forward. PCI 
 devices support bus mastering capability, such that the PCI devices 
 could take the ownership of the bus and perform access to the memory 
 directly, and a software support exists for the same in Linux.

 As far as USB devices are concerned, they don’t have the bus mastering 
 capability like the PCI devices.
 But the USB URB structure have a field named 'dma_addr_t transfer_dma', 
 used for DMA access. The USB driver allocate the DMA buffers coherently 
 and pass the DMA address to the URBs during its initialization.
 As far as Linux is concerned, how the DMA action being taking place for 
 USB devices. As per my understanding, the USB host controller is taking 
 care of the DMA operations. But I require a little more insight into it.

 Further more, if it is possible for the USB devices, then can this 
 support be also extended towards low-end protocols such as I2C or SPI?

 Thanks,
 Raghavendra

 ---
 [ C-DAC is on Social-Media too. Kindly follow us at:
 Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

 This e-mail is for the sole use of the intended recipient(s) and may
 contain confidential and privileged information. If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies and the original message. Any unauthorized review, use,
 disclosure, dissemination, forwarding, printing or copying of this email
 is strictly prohibited and appropriate legal action will be taken.
 ---


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

Thanks Chan.

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: DMA over USB

2014-07-02 Thread Raghavendra
On Wednesday 02 July 2014 11:55 AM, Greg KH wrote:
 On Wed, Jul 02, 2014 at 11:39:36AM +0530, Raghavendra wrote:
 On Wednesday 02 July 2014 11:42 AM, Greg KH wrote:
 On Wed, Jul 02, 2014 at 11:32:47AM +0530, Raghavendra wrote:
 On Wednesday 02 July 2014 11:02 AM, Greg KH wrote:
 On Tue, Jul 01, 2014 at 10:29:39PM -0700, Greg KH wrote:
 On Wed, Jul 02, 2014 at 10:40:21AM +0530, Raghavendra wrote:
 Hello,

 I have a query regarding DMA(Direct Memory Access) for the usb devices.

 The understanding of DMA actions over PCI is straight forward. PCI
 devices support bus mastering capability, such that the PCI devices
 could take the ownership of the bus and perform access to the memory
 directly, and a software support exists for the same in Linux.

 As far as USB devices are concerned, they don’t have the bus mastering
 capability like the PCI devices.
 But the USB URB structure have a field named 'dma_addr_t transfer_dma',
 used for DMA access. The USB driver allocate the DMA buffers coherently
 and pass the DMA address to the URBs during its initialization.
 As far as Linux is concerned, how the DMA action being taking place for
 USB devices. As per my understanding, the USB host controller is taking
 care of the DMA operations. But I require a little more insight into it.
 Why, what exactly are you concerned about?  What are you trying to do?
 Also, you _have_ read the USB DMA documentation, right?

 What about the documentation in this area is unclear?
 Yes, I have read the documentation and its fine. I am mostly concerned 
 about
 the all the heavy lifting happening in the background.
 Why?  What exactly are you concerned about?  What hardware controller?
 Is something not working properly?
 Everything is fine. This is more of a theoretical understanding.
 The code is there for your theoretical research :)
Ok thanks Greg. I shall look forward to it.

Regards,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


sysfs bind/unbind attributes usage

2014-07-01 Thread Raghavendra
Hello,

I would like to know more about manually probing/removing the devices 
through sysfs attributes.
After searching for a while I came across two attributes 'bind' and 
'unbind' present in all the drivers.

Now how may I correctly use them to probe my devices.
I sense the probing syntax is different for different kinds of drivers 
(I2C, SPI, PCI, USB, etc).
I am mainly looking for probing I2C and SPI devices.

Also I found related attributes called 'new_id and remove_id' (for PCI 
drivers) and also 'new_device and delete_device' (present in the i2c 
adapter devices). Now how are they different from the bind/unbind 
attributes, because as far as I know, even they do the same thing.

Could any one guide me through any documentation regarding all these issues

Thanks,
Raghavendra



---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


DMA over USB

2014-07-01 Thread Raghavendra
Hello,

I have a query regarding DMA(Direct Memory Access) for the usb devices.

The understanding of DMA actions over PCI is straight forward. PCI 
devices support bus mastering capability, such that the PCI devices 
could take the ownership of the bus and perform access to the memory 
directly, and a software support exists for the same in Linux.

As far as USB devices are concerned, they don’t have the bus mastering 
capability like the PCI devices.
But the USB URB structure have a field named 'dma_addr_t transfer_dma', 
used for DMA access. The USB driver allocate the DMA buffers coherently 
and pass the DMA address to the URBs during its initialization.
As far as Linux is concerned, how the DMA action being taking place for 
USB devices. As per my understanding, the USB host controller is taking 
care of the DMA operations. But I require a little more insight into it.

Further more, if it is possible for the USB devices, then can this 
support be also extended towards low-end protocols such as I2C or SPI?

Thanks,
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


issues dealing with kobjects

2014-06-20 Thread Raghavendra
Hello all,

I am facing a small issue dealing with kobjects.
I am writing a simple i2c driver for which I would like to export a few 
sysfs attributes(files).
The files are many, so I've decided to pack them into a directory in 
sysfs (inside the i2c device) and so I thought of kobjects.

My private data struture is something like this :
struct my_private {
 struct i2c_client *client;
 ...
 struct kobject kobj;
};

In my probe function, I am doing something like this :
int my_probe(struct i2c_client *client, ...)
{
 struct my_private *dev;

 dev = devm_kzalloc(...);
 pr_info(%x, dev);/* The address that I got is 
: 0xdbf94210 */

 

 /* Init. and add kboject */
 kobject_init(dev-kobj, client-dev.kobj.ktype);
 kobject_add(dev-kobj, client-dev.kobj, my_dir);

 /* Export sysfs group */
 sysfs_create_group(dev-kobj, my_attr_grp);

 
}

My show function for one of the attribute is something like this :
ssize_t show(struct kobject *kobj, ... )
{
 struct my_private *dev = container_of(kobj, struct my_private, kobj);
 pr_info(%x, dev);/* The address that I got is 
: 0xdbf94208 */

 
}

I tried to probe and remove the device mutilple times. Every time I am 
getting a difference of 2bytes for the 'dev'
pointer between probe and show functions.

Can anyone explain me where am I going wrong or is there any better way 
to create directories in sysfs?
I am building this module against 3.13.2 kernel.

Thank you.
Raghavendra.



---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Re: issues dealing with kobjects

2014-06-20 Thread Raghavendra
On Friday 20 June 2014 11:31 AM, Raghavendra wrote:
 Hello all,

 I am facing a small issue dealing with kobjects.
 I am writing a simple i2c driver for which I would like to export a few
 sysfs attributes(files).
 The files are many, so I've decided to pack them into a directory in
 sysfs (inside the i2c device) and so I thought of kobjects.

 My private data struture is something like this :
 struct my_private {
   struct i2c_client *client;
   ...
   struct kobject kobj;
 };

 In my probe function, I am doing something like this :
 int my_probe(struct i2c_client *client, ...)
 {
   struct my_private *dev;

   dev = devm_kzalloc(...);
   pr_info(%x, dev);/* The address that I got is
 : 0xdbf94210 */

   

   /* Init. and add kboject */
   kobject_init(dev-kobj, client-dev.kobj.ktype);
   kobject_add(dev-kobj, client-dev.kobj, my_dir);

   /* Export sysfs group */
   sysfs_create_group(dev-kobj, my_attr_grp);

   
 }

 My show function for one of the attribute is something like this :
 ssize_t show(struct kobject *kobj, ... )
 {
   struct my_private *dev = container_of(kobj, struct my_private, kobj);
   pr_info(%x, dev);/* The address that I got is
 : 0xdbf94208 */

   
 }

 I tried to probe and remove the device mutilple times. Every time I am
 getting a difference of 2bytes for the 'dev'
 pointer between probe and show functions.

 Can anyone explain me where am I going wrong or is there any better way
 to create directories in sysfs?
 I am building this module against 3.13.2 kernel.

 Thank you.
 Raghavendra.



 ---
 [ C-DAC is on Social-Media too. Kindly follow us at:
 Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

 This e-mail is for the sole use of the intended recipient(s) and may
 contain confidential and privileged information. If you are not the
 intended recipient, please contact the sender by reply e-mail and destroy
 all copies and the original message. Any unauthorized review, use,
 disclosure, dissemination, forwarding, printing or copying of this email
 is strictly prohibited and appropriate legal action will be taken.
 ---


 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
I guess I've solved the issue. Now the code looks something like this :

struct my_private {
  struct i2c_client *client;
  ...
  struct kobject *kobj; /* Converted variable to ptr */
};

int my_probe(struct i2c_client *client, ...)
{
  struct my_private *dev;

  dev = devm_kzalloc(...);
  
  

/* Replaced with kobject_init and kobject_add calls */
  dev-kobj = kobject_create_and_add(my_dir, client-dev.kobj);  

  /* Export sysfs group */
  sysfs_create_group(dev-kobj, my_attr_grp);

  
}

ssize_t show(struct kobject *kobj, ... )
{
struct device *i2cdev = kobj_to_dev(kobj-parent);
struct i2c_client *client = to_i2c_client(i2cdev);
struct my_private *dev = i2c_get_clientdata(client);

  
}

This approach worked, but there's a lot of redundancy in the show() function, 
just to obtain the pointer to the private data.
I would be glad if anyone suggested any better approach to create and manage 
sysfs directories and attribute groups.

Thank you,
Raghavendra

  






---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


git merge issues

2014-06-11 Thread Raghavendra
Hello everyone,

Assume that i have two branches in my repository: master and devel.

-- I've updated the master branch from the remote repository (using git 
pull).
Assume that the file name 'file.txt' has gone through an update.

-- Now the same file has also gone through a modification in the devel 
branch (manual editing)

-- Now when I do a 'git merge master' from my devel branch, I am facing 
a conflict issue something like this :

Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Automatic merge failed; fix conflicts and then commit the result.

Now my question is that do I need to solve the merging issue manually or 
is there any way to solve this using git?

Thank you.
Raghavendra

---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Patch submission issue

2014-06-10 Thread Raghavendra
Hello,

I am new to the kernel development community and I started off by fixing 
small coding style errors in the drivers/staging directory. I've created 
a patch for the same and sent it to the maintainer. The maintainer 
replied to me something like this :


Please don't do multiple things in the same patch, a single patch should
only do 1 thing.  So break this up into multiple patches.


And my patch looks something like this :

 From 7effd3d61c6ce08cd44df0a5ba3d1e9ac9ab5a98 Mon Sep 17 00:00:00 2001

From: Raghavendra ar...@cdac.in

Date: Tue, 10 Jun 2014 22:04:52 +0530

Subject: [PATCH] Staging: rtl8192e: dot11d: Fixed coding style issues

Replaced 'printk' with 'netdev_info' and 'netdev_err' wherever necessary.

Also fixed the coding issue cooresponding to line gap after the declarations.

Signed-off-by: Raghavendra ar...@cdac.in

---

  drivers/staging/rtl8192e/dot11d.c | 9 +

  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192e/dot11d.c 
b/drivers/staging/rtl8192e/dot11d.c

index 53da610..ef9da86 100644

--- a/drivers/staging/rtl8192e/dot11d.c

+++ b/drivers/staging/rtl8192e/dot11d.c

@@ -49,6 +49,7 @@ static struct channel_list ChannelPlan[] = {

  void dot11d_init(struct rtllib_device *ieee)

  {

  struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee);

+

  pDot11dInfo-bEnabled = false;

  

  pDot11dInfo-State = DOT11D_STATE_NONE;

@@ -133,12 +134,12 @@ void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 
*pTaddr,

  pTriple = (struct chnl_txpow_triple *)(pCoutryIe + 3);

  for (i = 0; i  NumTriples; i++) {

  if (MaxChnlNum = pTriple-FirstChnl) {

-printk(KERN_INFO Dot11d_UpdateCountryIe(): Invalid country IE, 
skip it1\n);

+netdev_info(dev-dev, Dot11d_UpdateCountryIe(): Invalid country 
IE, skip it1\n);

  return;

  }

  if (MAX_CHANNEL_NUMBER  (pTriple-FirstChnl +

  pTriple-NumChnls)) {

-printk(KERN_INFO Dot11d_UpdateCountryIe(): Invalid country IE, 
skip it2\n);

+netdev_info(dev-dev, Dot11d_UpdateCountryIe(): Invalid country 
IE, skip it2\n);

  return;

  }

  

@@ -165,7 +166,7 @@ u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 
Channel)

  u8 MaxTxPwrInDbm = 255;

  

  if (MAX_CHANNEL_NUMBER  Channel) {

-printk(KERN_INFO DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n);

+netdev_info(dev-dev, DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n);

  return MaxTxPwrInDbm;

  }

  if (pDot11dInfo-channel_map[Channel])

@@ -204,7 +205,7 @@ int ToLegalChannel(struct rtllib_device *dev, u8 channel)

  }

  

  if (MAX_CHANNEL_NUMBER  channel) {

-printk(KERN_ERR %s(): Invalid Channel\n, __func__);

+netdev_err(dev-dev, %s(): Invalid Channel\n, __func__);

  return default_chn;

  }

  

-- 

1.8.1.2

Can anyone please guide me through my mistake.

Thank you.



---
[ C-DAC is on Social-Media too. Kindly follow us at:
Facebook: https://www.facebook.com/CDACINDIA  Twitter: @cdacindia ]

This e-mail is for the sole use of the intended recipient(s) and may
contain confidential and privileged information. If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies and the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email
is strictly prohibited and appropriate legal action will be taken.
---


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


Query on vfs interface

2012-12-20 Thread Raghavendra G
Hello
I am trying to log all the calls going to the VFS file system from the 
application.

For write calls I notice an anomaly.  I introduced a log at the vfs_write() 
function , I see it get's logged twice  for every write in the log output.
I also tried do_sync_write() the result is same.

Time stampVFS Action filename   

 Size  time taken(us)
626.212738

OPEN

/data/media/DCIM/Camera/VID_2101_002412.mp4.tmp

flags=131585

mode =0

  628.187652

WRITE

VID_2101_002412.mp4.tmp

101606

611

  628.187713

WRITE

VID_2101_002412.mp4.tmp

101606

1160


  628.188995

WRITE

VID_2101_002412.mp4.tmp

69782

457

  628.189056

WRITE

VID_2101_002412.mp4.tmp

69782

885


Any clue why this anomaly ?

Warm Regards
Raghavendra G

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


Re: Re: which local FS supports concurrent direct IO write?

2012-01-15 Thread Raghavendra D Prabhu

Hi Zheng,

Interesting analysis. 


* On Sun, Jan 15, 2012 at 03:17:12PM -0500, Zheng Da zhengda1...@gmail.com 
wrote:

Thanks. I was reading the code of kernel 3.0. XFS starts to support
concurrent direct IO since kernel 3.1.5.
But concurrent direct IO write still doesn't work well in kernel 3.2. 
From what I have heard it has supported it from sometime back. I 
think you may need to ask in xfs general ML about this.




I wrote a test program that accesses a 4G file randomly (read and write), and
I ran it with 8 threads and the machine has 8 cores. It turns out that only
1 core is running. I'm pretty sure xfs_rw_ilock is locked
with XFS_IOLOCK_SHARED in xfs_file_dio_aio_write.

lockstat shows me that there is a lot of wait time in ip-i_lock. It seems
the lock is locked exclusively.
  (ip-i_lock)-mr_lock-W: 31568  36170
 0.24   20048.25 7589157.99 1301543146848
 0.00 217.70 1238310.72
  (ip-i_lock)-mr_lock-R: 11251  11886
 0.24   20043.01 2895595.18  46671 526309
 0.00  63.80  264097.96
  -
(ip-i_lock)-mr_lock  36170
[a03be122] xfs_ilock+0xb2/0x110 [xfs]
(ip-i_lock)-mr_lock  11886
[a03be15a] xfs_ilock+0xea/0x110 [xfs]
  -
(ip-i_lock)-mr_lock  38555
[a03be122] xfs_ilock+0xb2/0x110 [xfs]
(ip-i_lock)-mr_lock   9501
[a03be15a] xfs_ilock+0xea/0x110 [xfs]

Then I used systemtap to instrument xfs_ilock and find there are at least 3
functions that lock ip-i_lock exclusively during write.


From what I saw in xfs_file_dio_aio_write code, it uses EXCL only 
if there is unaligned IO   or there are cached pages to be 
invalidated after shared lock is obtained *but* it demotes that 
lock to SHARED just before generic_file_direct_write. 


Is there any popular FS that supports concurrent direct IO well?

Thanks,
Da

On Sat, Jan 14, 2012 at 6:45 AM, Raghavendra D Prabhu 
raghu.prabh...@gmail.com wrote:


Hi Zheng,




* On Fri, Jan 13, 2012 at 04:41:16PM -0500, Zheng Da 
zhengda1...@gmail.com wrote:



Hello,



I'm looking for a FS in Linux that supports concurrent direct IO write.
ext4 supports concurrent direct IO read if we mount it with
dioread_nolock,
but doesn't support concurrent writes. XFS doesn't support concurrent
direct IO at all. It locks the inode exclusive if it's direct IO. I tried
btrfs, and it seems it doesn't support concurrent direct IO either though
I
haven't looked into its code.
Is there a local FS that support concurrent direct IO write? It seems NFS
supports it (
http://kevinclosson.wordpress.**com/2011/08/12/file-systems-**
for-a-database-choose-one-**that-couples-direct-io-and-**
concurrent-io-whats-this-have-**to-do-with-nfs-harken-back-5-**
2-years-to-find-out/http://kevinclosson.wordpress.com/2011/08/12/file-systems-for-a-database-choose-one-that-couples-direct-io-and-concurrent-io-whats-this-have-to-do-with-nfs-harken-back-5-2-years-to-find-out/
),
but I'm looking for local FS.



Thanks,
Da




 __**_

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




XFS locks inode exclusive only if it is an unaligned Direct IO, which is
apparently done to prevent race conditions -- refer to this
http://oss.sgi.com/archives/**xfs/2011-01/msg00157.htmlhttp://oss.sgi.com/archives/xfs/2011-01/msg00157.htmlAlso
 the behavior of Ext4 under dioread_nolock is supported by XFS by
default and in a much better way. Also Ext4 is the only one which uses
DIO_LOCKING while doing direct io.





Regards,
--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net





Regards,
--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net


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


Re: which local FS supports concurrent direct IO write?

2012-01-14 Thread Raghavendra D Prabhu

Hi Zheng,

* On Fri, Jan 13, 2012 at 04:41:16PM -0500, Zheng Da zhengda1...@gmail.com 
wrote:

Hello,

I'm looking for a FS in Linux that supports concurrent direct IO write.
ext4 supports concurrent direct IO read if we mount it with dioread_nolock,
but doesn't support concurrent writes. XFS doesn't support concurrent
direct IO at all. It locks the inode exclusive if it's direct IO. I tried
btrfs, and it seems it doesn't support concurrent direct IO either though I
haven't looked into its code.
Is there a local FS that support concurrent direct IO write? It seems NFS
supports it (
http://kevinclosson.wordpress.com/2011/08/12/file-systems-for-a-database-choose-one-that-couples-direct-io-and-concurrent-io-whats-this-have-to-do-with-nfs-harken-back-5-2-years-to-find-out/),
but I'm looking for local FS.

Thanks,
Da



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


XFS locks inode exclusive only if it is an unaligned Direct 
IO, which is apparently done to prevent race conditions -- 
refer to this  http://oss.sgi.com/archives/xfs/2011-01/msg00157.html 
Also the behavior of Ext4 under dioread_nolock is supported 
by XFS by default and in a much better way. Also Ext4 is the only 
one which uses DIO_LOCKING while doing direct io.




Regards,
--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net


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


Re: Packet drop while using BPF filter

2011-12-22 Thread Raghavendra D Prabhu
Hi,

 Have you tried enabling -- /proc/sys/net/core/bpf_jit_enable --
 provides JIT compiled BPF  on 64 bit linux.

* On Wed, Dec 21, 2011 at 12:08:04AM +0530, Mukesh Yadav mukesh@gmail.com 
wrote:
Hi Guys,

I am working on user level code which uses BPF filter.
Solution has two threads and  BPF filter for incoming packets to raw socket
dedicated to each thread.
Intent is to divide ingress traffic between two thread based on whether
dest IP is even or odd.

BPF filters used are:
Even IP filter :- tcpdump -i interface 'ether dst dest mac  ip[19] 
0x01 = 0'
Odd IP filter :-  tcpdump -i interface  'ether dst dest mac  ip[19] 
0x01 = 1'

There is a packet loss for odd IP thread even when CPU is available. Reason
being packet drop due  recv buffer full.
Same amount of traffic is well handled by even IP thread(user code being
same in both), scaling CPU to full 100%.

In odd IP thread, If filter is changed to tcpdump -i interface  'ether dst
dest mac  ip proto 17' , all goes fine.
Also CPU usage at kernel drops from 50% to 4 % for a particular amount of
traffic.

Would appreciate any I/ps for reducing load at kernel for packet
filtering(Odd/Even IP distribution)


Cheers
Mukesh

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

--
Raghavendra Prabhu
GPG Id : 0xD72BE977
Fingerprint: B93F EBCB 8E05 7039 CD3C A4B8 A616 DCA1 D72B E977
www: wnohang.net

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