mntinfo of process

2015-03-14 Thread Nilesh Chate
Hi,
Considering the the output of
#cat /proc/pid/mountinfo

I have this line for one of my process
39 38 0:10 /1 /dev/console rw,relatime shared:7 - devpts devpts
rw,mode=600,ptmxmode=000

Here,
/1 is root: root of the mount within the filesystem.(man 5 proc)

What is this /1?

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


Re: Handling interrupts in spidev

2014-02-13 Thread Nilesh Bacchewar
you can use Asynchronous notification  , FASYNC .

http://www.makelinux.net/ldd3/chp-6-sect-4

Regards,
Nilesh


On Tue, Jan 28, 2014 at 9:47 PM, Vishwanath Govind <
vishwanath.gov...@gmail.com> wrote:

> You can implement irq handler in spi driver itself. SPI specific platform
> data can pass it from board file.
> Regards
> Vishwa
>
>
> On Tue, Jan 28, 2014 at 9:24 PM, Richard Weinberger wrote:
>
>> Am 28.01.2014 15:12, schrieb Amit Mahadik:
>> > Thanks Richard. One more question. If I register an SPI irq  struct
>> spi_board_info spi_board_info[] structure in machine board.c file; then the
>> request irq api and irq handler
>> > should be written in board.c file or in the spidev driver.
>>
>> Never do any programming in the board file.
>> The purpose if the board file it describing the hardware.
>> Please note, board files go away, device tree is the way to go.
>>
>> Thanks,
>> //richard
>>
>> ___
>> 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: [OOT] About the symbols in binary file.

2012-01-20 Thread nilesh
On Friday 20 January 2012 03:37 PM, Daniel Baluta wrote:
> On Fri, Jan 20, 2012 at 11:56 AM, nilesh  wrote:
>> Hi,
>>
>> The question is not completely related to kernel. But I came across
>> similar question when debugging in kernel.
>>
>> I tried dissecting the SSL library using 'nm' command. It is showing the
>> list of symbols along with some generic addresses (to be used when
>> relocating).
>> Also there are some characters 't', 'T', 'U'. I guess these correspond
>> to properties of symbols - like static, extern etc.
>>
>> Could someone please point out what exactly each character corresponds to?
>> I mean looking at the character, we should be able to denote if it's a
>> static symbol or inline etc. Do we have any such mapping?
>
> man nm :)
Missed that..Sorry for being lazy to check before posting the dumb query. :)

>
> thanks,
> Daniel.

-- 
Thanks,
Nilesh

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


[OOT] About the symbols in binary file.

2012-01-20 Thread nilesh
Hi,

The question is not completely related to kernel. But I came across 
similar question when debugging in kernel.

I tried dissecting the SSL library using 'nm' command. It is showing the 
list of symbols along with some generic addresses (to be used when 
relocating).
Also there are some characters 't', 'T', 'U'. I guess these correspond 
to properties of symbols - like static, extern etc.

Could someone please point out what exactly each character corresponds to?
I mean looking at the character, we should be able to denote if it's a 
static symbol or inline etc. Do we have any such mapping?

0499 t tls1_PRF
0019 t tls1_P_hash
 T tls1_alert_code
0937 T tls1_cert_verify_mac
0ffa T tls1_change_cipher_state
0a22 T tls1_enc
06fc T tls1_final_finish_mac
063d T tls1_generate_master_secret
1734 T tls1_mac
0d2a T tls1_setup_key_block


-- 
Thanks,
Nilesh

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


Re: Suspicious URL:Re: Check Interface Status

2011-12-30 Thread nilesh
On Friday 30 December 2011 02:06 PM, 
mic...@michaelblizek.twilightparadox.com wrote:
> Hi!
>
> On 12:30 Fri 30 Dec , nilesh wrote:
>> On Thursday 29 December 2011 08:23 PM, Rahul Kumar wrote:
>>> Hi,
>>>
>>> I would like to check the interface status (up/down) within linux kernel.
>>> Is there any routine (sort of ioctl) to do this. Any code that is
>>> already in use in kernel would also be helpful for me.
>>> Please let me know.
>>>
>> I think netif_carrier_ok() could help. You can refer network driver
>> code(e.g. e1000_main.c).
>
> This looks more like "cable attached" rather than "interface up".
Oh yes, it will just tell us if the carrier is available.
IFF_UP flag is the right way, as you suggested in the other email.

>
>   -Michi

-- 
Thanks,
Nilesh

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


Re: Check Interface Status

2011-12-29 Thread nilesh
On Thursday 29 December 2011 08:23 PM, Rahul Kumar wrote:
> Hi,
>
> I would like to check the interface status (up/down) within linux kernel.
> Is there any routine (sort of ioctl) to do this. Any code that is
> already in use in kernel would also be helpful for me.
> Please let me know.
>
I think netif_carrier_ok() could help. You can refer network driver 
code(e.g. e1000_main.c).

-- 
Thanks,
Nilesh

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


Re: Learning Linux Kernel

2011-12-12 Thread nilesh
On Tuesday 13 December 2011 05:37 AM, Kaushal Shriyan wrote:
> On Tue, Dec 13, 2011 at 5:21 AM, Alexandru Juncuwrote:
>
>> On Tue, Dec 13, 2011 at 1:39 AM, Kaushal Shriyan
>>   wrote:
[...]
>>
>> [1]
>> http://www.amazon.com/Linux-Kernel-Development-Robert-Love/dp/0672329468/ref=pd_sim_b_3
>> [2] http://www.youtube.com/watch?v=LLBrBBImJt4
>>
>
>
> Hi
>
> Just curious to know about total number of linux kernel developers in the
> world who contribute to linux kernel codebase. Any wiki or webpage which
> mentions about it?

Also you might want to check this video uploaded on Youtube.
Nice explanation on how exactly the Kernel Developers' community works, 
along with the statistics (old ones, though).
http://www.youtube.com/watch?v=L2SED6sewRw

>
> Regards
>
> Kaushal
>

-- 
Thanks,
Nilesh

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


Re: Query about the realtime processes scheduling.

2011-08-18 Thread nilesh
On Thursday 18 August 2011 12:18 PM, nilesh wrote:
> Hi,
>
> I am not too familiar with Linux scheduler. What I could understand
> theoretically is - the interactive processes get advantage (-5) in priority.
> And hence the effective priority is higher.
>
> Query:
> Is this true for realtime processes ( with SCHED_FIFO/SCHED_RR policy)
> as well? Could the realtime processes be I/O bound or interactive?
>
Please ignore the post.
I should have looked into the code before posting the query. It looks 
like the bonus/penalty is only for non-realtime tasks.

2101static int effective_prio(struct task_struct *p)
2102{
2103p->normal_prio = normal_prio(p);
2104/*
2105 * If we are RT tasks or we were boosted to RT priority,
2106 * keep the priority unchanged. Otherwise, update priority
2107 * to the normal priority:
2108 */
2109if (!rt_prio(p->prio))
2110return p->normal_prio;
2111return p->prio;
2112}
2113

-- 
Thanks,
Nilesh

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


Query about the realtime processes scheduling.

2011-08-17 Thread nilesh
Hi,

I am not too familiar with Linux scheduler. What I could understand 
theoretically is - the interactive processes get advantage (-5) in priority.
And hence the effective priority is higher.

Query:
Is this true for realtime processes ( with SCHED_FIFO/SCHED_RR policy) 
as well? Could the realtime processes be I/O bound or interactive?

-- 
Thanks,
Nilesh

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


Re: xx_initcall ( ) in kernel

2011-07-13 Thread nilesh
Hi Sumeet,

On Wednesday 13 July 2011 04:12 PM, sumeet linux wrote:
> Dear friends,
>
> I want to know the basics xx_initcall ( ) in linux kernel. How this function
> works ?
> Observed in kernel code, many places late_initcall ( ), early_initcall ( ),
> arch_initcall ( ), core_initcall ( ) gets called.
> When did all these functions gets call during kernel initialization ?
> I am more interested in what is the sequence of these functions gets called
> one after another.
I could get a nice link explaining about *_initcall(). Refer:
http://book.opensourceproject.org.cn/embedded/embeddedprime/opensource/0136130550/ch05lev1sec4.html

*_initcall() are macros which set the function pointers for subsystem 
initialization (typedef int (*initcall_t)(void) : typedef of all such 
function pointers).
Also if we look at the source code, the functions are called in below 
sequence:
http://lxr.linux.no/#linux+v2.6.39/init/main.c#L695

do_basic_setup(void) -> do_initcalls(void) -> do_one_initcall(*fn);
do_one_initcall(*fn) - calls each function. And do_basic_setup() is 
called inside the initialization sequence (kernel_init()).

>
> Thank you.
>
> Regards,
> Sumeet
>

-- 
Thanks,
Nilesh

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


Re: Query about a PCI device error detection.

2011-07-13 Thread Nilesh
Resending the email to kernelnewbies list as well (have sent the same to 
edac mailing list). Appreciate any pointers on below query, if any one 
has worked on edac.

On Wednesday 06 July 2011 03:56 PM, nilesh wrote:
> Hi,
>
> I am fairly new to the edac driver and have some basic query regarding
> the error detection in case of PCI devices. I could see the module for
> memory controller's error detection is done s.t. UE/CE/controller
> specific errors are scanned and detected, also the PCI errors are also
> scanned.
>
> E.g. in case of i5400 :
> i5400_edac.c :
> i5400_probe1()
> {
>
> 1285 /* Set the function pointer to an actual operation function
> */
> 1286 mci->edac_check = i5400_check_error;
> ...
> 1312 /* allocating generic PCI control info */
> 1313 i5400_pci = edac_pci_create_generic_ctl(&pdev->dev,
> EDAC_MOD_STR);
> }
>
> And we check the PCI status registers for the errors.
> edac_pci_generic_check() -->  edac_pci_do_parity_check() -->
> edac_pci_dev_parity_test()
>
> So, i5400_check_error - detect UE/CE.
> edac_pci_generic_check - detect PCI errors.
>
> Query:
> --
> * If one wants to get the errors harvested for non-MC device (e.g.
> ethernet controller etc.) is it going to be done through
> edac_pci_generic_check() automatically - as we already scan through all
> PCI devices in a loop? Is it required to add the separate module for
> that device?
>

-- 
Thanks,
Nilesh

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


Re: questions for Linus

2011-06-23 Thread nilesh
On Wed, 2011-06-01 at 12:51 +0530, nilesh wrote:
> On Wed, 2011-06-01 at 16:02 +0900, Greg KH wrote:
> > On Wed, Jun 01, 2011 at 12:10:45PM +0530, nilesh wrote:
> [...]
> > 
> > It just happened a few hours ago, so I think it might be a week or so
> > before the video is posted to the web site.  I'll ask the orginizers and
> > try to find out when it will show up.
> > 
> Ok. Thanks a lot.
> 
I just noticed the interview is now available on youtube also, in case
someone missed it.
http://www.youtube.com/watch?v=__fALdvvcM0

> > I'm sure there will be some news reports of the talk in a few days as
> > well, there were lots of fun quotes that I'm sure will be repeated, they
> > are already all over twitter in places...
> > 
> > thanks,
> > 
> > greg k-h


-- 
Thanks,
Nilesh

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


Regarding Edac support on E8400 processor.

2011-06-06 Thread nilesh
Hi,

I am trying to enable and test EDAC functionality on my desktop running
2.6.39 kernel. But I do not see any EDAC support in /sys/devices (e.g.
support for parity errors enable/disable for PCI devices etc.).

Could someone please advice if I am missing anything? Is EDAC completely
not supported for E8400 (I do not see the kernel module for this one)? 

-- 
Thanks,
Nilesh

P.S. Below are few of the details:

* CPU information
root@nilesh-desktop:linux-2.6.39 # cat /proc/cpuinfo 
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 23
model name  : Intel(R) Core(TM)2 Duo CPU E8400  @ 3.00GHz
stepping: 10
cpu MHz : 2000.000
cache size  : 6144 KB

* EDAC modules I tried to insert and were inserted without error.
root@nilesh-desktop:linux-2.6.39 # lsmod | grep -i EDAC
i7300_edac 12270  0 
r82600_edac 3686  0 
i5100_edac  5847  0 
i5400_edac 12136  0 
i5000_edac 13402  0 
e7xxx_edac  5085  0 
e752x_edac 11985  0 
i7core_edac21192  0 
edac_core  55426  8
i7300_edac,r82600_edac,i5100_edac,i5400_edac,i5000_edac,e7xxx_edac,e752x_edac,i7core_edac

* Config file snippet.
root@nilesh-desktop:linux-2.6.39 # cat .config | grep EDAC
CONFIG_EDAC=y
CONFIG_EDAC_DEBUG=y
# CONFIG_EDAC_DECODE_MCE is not set
CONFIG_EDAC_MM_EDAC=m
CONFIG_EDAC_MCE=y
CONFIG_EDAC_AMD76X=m
CONFIG_EDAC_E7XXX=m
CONFIG_EDAC_E752X=m
CONFIG_EDAC_I82875P=m
CONFIG_EDAC_I82975X=m
CONFIG_EDAC_I3000=m
CONFIG_EDAC_I3200=m
CONFIG_EDAC_X38=m
CONFIG_EDAC_I5400=m
CONFIG_EDAC_I7CORE=m
CONFIG_EDAC_I82860=m
CONFIG_EDAC_R82600=m
CONFIG_EDAC_I5000=m
CONFIG_EDAC_I5100=m
CONFIG_EDAC_I7300=m


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


Re: questions for Linus

2011-06-01 Thread nilesh
On Wed, 2011-06-01 at 16:02 +0900, Greg KH wrote:
> On Wed, Jun 01, 2011 at 12:10:45PM +0530, nilesh wrote:
[...]
> 
> It just happened a few hours ago, so I think it might be a week or so
> before the video is posted to the web site.  I'll ask the orginizers and
> try to find out when it will show up.
> 
Ok. Thanks a lot.

> I'm sure there will be some news reports of the talk in a few days as
> well, there were lots of fun quotes that I'm sure will be repeated, they
> are already all over twitter in places...
> 
> thanks,
> 
> greg k-h


-- 
Thanks,
Nilesh

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


Re: questions for Linus

2011-05-31 Thread nilesh
Hi Greg,

Included the list as the recipient.
On Wed, 2011-06-01 at 10:44 +0900, Greg KH wrote:
> On Tue, May 31, 2011 at 02:12:36PM +0700, Mulyadi Santosa wrote:
> > Hi Greg..
> > 
> > I came with these questions for Linus, hope you're kind enough to
> > collect it and forward it to Linus in LinuxCon:
> 
> Thanks for all of the questions everyone, they helped out immensely and
> the interview went well.
> 
> I think it will be posted online in video form soon, so check the linux
> foundation web site for the link if you are interested.
> 
Sorry if I got it wrong, but is the interview (in text form) or video
posted on linuxfoundation? Or is it yet to be done? I visited the site
and I do not see that.

> greg k-h
> 

-- 
Thanks,
Nilesh

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


Re: Interpreting call trace

2011-04-07 Thread nilesh
Hi Daniel,

On Thu, 2011-04-07 at 11:26 +0300, Daniel Baluta wrote:
> > For better understanding you can do
> >> gdb vmlinux
> > and then run
> > gdb> disassemble _read_unlock_bh
> >
> > Then look at offset 0x10.
> 
> Did that. Is there any way to show disassembled
> output interleaved with source code?
> 
May be you can try taking the 'objdump' of vmlinux (FYI, it will be
quite big in size). Otherwise try taking objdump of specific binary
only.

#objdump -r -D -l -S 
> 
> thank you all for your answers.
> 
> Daniel.

-- 
Thanks,
Nilesh

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


RE: i see the intel i915 black screen issue is back

2011-01-28 Thread Tayade, Nilesh
Resending..

 On Wed, 2011-01-26 at 07:16 -0500, Robert P. J. Day wrote:
 > On Wed, 26 Jan 2011, Greg KH wrote:
 >
 > > On Tue, Jan 25, 2011 at 09:34:48PM -0500, Robert P. J. Day
 wrote:
 > > >
 > > >   just built a new kernel for ubuntu 10.10 (2.6.38-rc2) and,
 > > > depressingly, this kernel once again boots to a black screen
 given
 > > > th= intel i915 onboard video.  this is getting frustrating.
 > >
 > > Then let the i915 developers know about this, they just fixed a
 > > number of issues relevant to this.
 > >
 > > Complaining on a random mailing list will not get this resolved,
 no
 > > matter how much we wish it were so :)
 >
 >   point taken.  that was just some residual frustration left over
 from
 > weeks of tolerating that problem, to see it *finally* (or so i
 > thought) go away, then to suddenly come back right when i'm trying
 to
 > put together a LUG talk on building a new kernel.  grr.
 >
 >   so the obvious question is, is anyone else seeing this problem
 back
 > again?  i note one person who claims that things still seem to
 work.
 > anyone else?  or could it really just be something weird i've
 done?
 
 It worked on my Ubuntu-Desktop. Ubuntu version: 10.04.
 Please see the attached config file (I have not enabled/disabled any
 config parameter - it is a default one).
 
 >
 > rday
 >
 > p.s.  i posted to the dri-devel list, let's see what i hear back.
 >

--
Thanks,
Nilesh





config_2.6.38-rc2.tar.bz2
Description: config_2.6.38-rc2.tar.bz2
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: i see the intel i915 black screen issue is back

2011-01-28 Thread nilesh
On Wed, 2011-01-26 at 07:16 -0500, Robert P. J. Day wrote:
> On Wed, 26 Jan 2011, Greg KH wrote:
> 
> > On Tue, Jan 25, 2011 at 09:34:48PM -0500, Robert P. J. Day wrote:
> > >
> > >   just built a new kernel for ubuntu 10.10 (2.6.38-rc2) and,
> > > depressingly, this kernel once again boots to a black screen given the
> > > intel i915 onboard video.  this is getting frustrating.
> >
> > Then let the i915 developers know about this, they just fixed a
> > number of issues relevant to this.
> >
> > Complaining on a random mailing list will not get this resolved, no
> > matter how much we wish it were so :)
> 
>   point taken.  that was just some residual frustration left over from
> weeks of tolerating that problem, to see it *finally* (or so i
> thought) go away, then to suddenly come back right when i'm trying to
> put together a LUG talk on building a new kernel.  grr.
> 
>   so the obvious question is, is anyone else seeing this problem back
> again?  i note one person who claims that things still seem to work.
> anyone else?  or could it really just be something weird i've done?

It worked on my Ubuntu-Desktop. Ubuntu version: 10.4.
Please see the attached config file (I have not enabled/disabled any
config parameter - it is a default one).

> 
> rday
> 
> p.s.  i posted to the dri-devel list, let's see what i hear back.
> 




config_2.6.38-rc2.tar.bz2
Description: application/bzip-compressed-tar
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Test message - please ignore.

2011-01-27 Thread Tayade, Nilesh
My emails are not reaching to kernelnewbies list. This is a test message
just to check.

--
Thanks,
Nilesh


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


Re: spin_lock and scheduler confusion

2011-01-07 Thread nilesh
On Fri, 2011-01-07 at 13:33 +0530, anish singh wrote:
> 
> 
> On Fri, Jan 7, 2011 at 1:19 PM, nilesh 
> wrote:
> On Fri, 2011-01-07 at 13:05 +0530, Rajat Sharma wrote:
> > As I remember timer interrupt as well is an NMI so, it is
> possible
> > (although not advised) to call schedule function while
> holding
> > spinlock on same core.
> >
> > spin_lock_irqsave();
> > schedule();
> > spin_lock_irqrestore();
> >
> > however if you have debugging options turned on like
> > CONFIG_DEBUG_SPINLOCK, you may likely get kernel warning for
> > 'scheduling in atomic context'.
> >
> > Then what can happen if this core is allowed to switched to
> new
> > process? Consider the case where new process as well tries
> to aquire
> > same spin_lock() which new process can not aquire and start
> spinning
> > for the lock for ever :). Likewise, other cores will also
> get locked
> > down.
> >
> > However stil you can detect softlockup through NMI watchdog.
> 
> 
> >>Sorry if I am building up the confusion here. But as Dave
> Hylands
> >>initially mentioned, there will be no timer interrupt. So
> shouldn't the
> >>NMI watchdog get triggered then? No interrupts -> system
> freeze -> NMI
> >>Wdt reboot.
> 
> In my opinion(uninformed ) NMI watchdog will be triggered only in case
> where you are holding a spinlock.It will not be triggered just because
> timer interrupts are disabled due to holding a spinlock.
> 
No, what I meant is - we have masked all the interrupts before holding
the spinlock (and not even getting the timer interrupts) so it's as good
as system freeze. And we should trigger the NMI watchdog, isn't it?

-- 
Thanks,
Nilesh

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


Re: spin_lock and scheduler confusion

2011-01-06 Thread nilesh
On Fri, 2011-01-07 at 13:05 +0530, Rajat Sharma wrote:
> As I remember timer interrupt as well is an NMI so, it is possible
> (although not advised) to call schedule function while holding
> spinlock on same core.
> 
> spin_lock_irqsave();
> schedule();
> spin_lock_irqrestore();
> 
> however if you have debugging options turned on like
> CONFIG_DEBUG_SPINLOCK, you may likely get kernel warning for
> 'scheduling in atomic context'.
> 
> Then what can happen if this core is allowed to switched to new
> process? Consider the case where new process as well tries to aquire
> same spin_lock() which new process can not aquire and start spinning
> for the lock for ever :). Likewise, other cores will also get locked
> down.
> 
> However stil you can detect softlockup through NMI watchdog.

Sorry if I am building up the confusion here. But as Dave Hylands
initially mentioned, there will be no timer interrupt. So shouldn't the
NMI watchdog get triggered then? No interrupts -> system freeze -> NMI
Wdt reboot. 

http://slacksite.com/slackware/nmi.html

> 
> Rajat

-- 
Thanks,
Nilesh

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


RE: spin_lock and scheduler confusion

2011-01-06 Thread Tayade, Nilesh
Hi,

> -Original Message-
> From: kernelnewbies-boun...@kernelnewbies.org [mailto:kernelnewbies-
> boun...@kernelnewbies.org] On Behalf Of Dave Hylands
> Sent: Friday, January 07, 2011 10:59 AM
> To: Viral Mehta
> Cc: kernelnewbies@kernelnewbies.org
> Subject: Re: spin_lock and scheduler confusion
> 
> Hi Viral,
> 
> On Wed, Jan 5, 2011 at 2:23 PM, Viral Mehta
>  wrote:
> >
> > Hi ,
> >
> > I need your help to solve below confusion.
> >
[...]
> 
> Note that you can't sleep while you hold a spinlock. You're not
> allowed to perform any type of blocking operations. If you're holding
> the spinlock for any significant length of time, then you're using the
> wrong design.
> 
> >     spin_lock_irqrestore();
> > 3. One of the CPU core tries to execute this code and so acquires the
> lock.
> > 4. Now, second core is also goes to execute same piece of code and so
> will
[...]
> 
> Not while it's holding the spinlock or waiting for the spinlock.
> 
> > Ever if timeslice is over for the current task ?
> 
> The time tick interrupt is what determines when the timeslice is over.
> Since you have interrupts disabled, the timer interrupt can't happen.
> 
> > What if scheduler code is running on CPU core-3 and sees that
> > timeslice for task running on CPU core-2 has expired ?
> 
> Each core only considers the timeslices for its own core.
> 
> > I guess timeslice expire case is not as same as preemption. Or may be
> I am
> > terribly wrong.
> 
> You shouldn't be holding  a spinlock for periods of time approaching
> the length of a timeslice. The timer interrupt is what determines the
> end of a timeslice. No timer interrupt, no end of a timeslice.
> Preemption is also triggered by the timer interrupt, or by releasing a
> resource that a higher priority task is waiting for.

May be my understanding is incorrect, but wouldn't we hit the NMI watchdog 
here(assuming we are running on x86/x86_64)? 
We have a system lockup for long time.
http://lxr.linux.no/#linux+v2.6.37/Documentation/nmi_watchdog.txt

Could someone please clarify?
> 
> Dave Hylands

--
Thanks,
Nilesh

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


Re: functions about dump backtrace function names in mips arch

2011-01-03 Thread nilesh
On Mon, 2011-01-03 at 22:32 +0800, loody wrote:
> hi all:
> 
> 2011/1/3 Sowmya Sridharan :
> >
> > Hi,
> >
> > I was able to check it in 2.6.36 version of kernel, and it is defined in
> > traps.c.
> > http://lxr.linux.no/linux+v2.6.36/arch/mips/kernel/traps.c#L205
> >
> > dump_stack() calls show_backtrace function which had been show_trace in the
> > earlier kernel versions.
[...]
> >
> >
[...]
> > Regards,
> > Sowmya
> thanks for your kind help, that is what I want.
> previously, I only see the address instead of function name, but after
> I select CONFIG_KALLSYMS as Y, I can see the function names also.
> BTW, what is the mechanism that kernel take to find out the function name?

Enabling the config option, it allows to build the symbol table for
kernel. It uses /proc/kallsyms.
Below links could help:
http://tldp.org/HOWTO/Module-HOWTO/x627.html
http://fixunix.com/kernel/134739-proc-kallsyms-symbol-size.html

> Regards,
> miloody

-- 
Thanks,
Nilesh

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


Re: copy_to_user

2010-12-24 Thread Nilesh Tayade
On Fri, 2010-12-24 at 01:00 -0800, Dave Hylands wrote:
> Hi Nilesh.
> 
> On Thu, Dec 23, 2010 at 11:59 PM, Nilesh Tayade
>  wrote:
> ...snip...
> > I tried it, and it seems adding mutex_init() works as Mukti mentioned. I
> > did get a kernel oops before (but no segfault). After adding
> > mutex_init() there is no oops/segfault. The code, however, is reading
> > the garbage, that needs to be fixed.
> 
>   char n[20];
>   short a = *((short *)&n[0]);
>   short b = *((short *)&n[2]);
>   short c = *((short *)&n[4]);
> 
> This sets a b and c to have essentially random values.
> 
>   nbytes = read( fd, n, 40);
> 
> This causes the value of n to change. However, the values of a, b, and
> c retain the same random values you assigned them above.
> 
>   printf( "\r a = %d \n ", a);
>   printf("\r b = %d \n",b);
>   printf("\r c = %d \n",c);
> 
> This prints the random values of a, b, and c rather than printing thee
> values of n that you read in.

Thanks for the explanation Dave.

I did not really bother to debug to avoid the garbage values, as the
main concern was for segfault and kernel oops.

> 
> Dave Hylands


-- 
Thanks,
Nilesh

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


Re: copy_to_user

2010-12-24 Thread Nilesh Tayade
Hi,

On Fri, 2010-12-24 at 11:37 +0530, Hemanth Kumar wrote:

> 
> > >
> 
> The mutex initialization is missing. 
> Adding  mutex_init(&timer); in the driver init will make it
> work.
> 
> Thanks,
> Mukti
> 
> 
> Hi All,
> 
> Can anybody please share some idea ,why I am getting
> segmentation fault & kernel oops,
> 
> Regards,
> 

I tried it, and it seems adding mutex_init() works as Mukti mentioned. I
did get a kernel oops before (but no segfault). After adding
mutex_init() there is no oops/segfault. The code, however, is reading
the garbage, that needs to be fixed.

pun-nilesht-dt0:/home/nilesh/Documents/handson # !mknod
mknod /dev/mytimer c 300 0

pun-nilesht-dt0:/home/nilesh/Documents # dmesg 
[ 2193.684735] Register timer maj = 300

pun-nilesht-dt0:/home/nilesh/Documents/handson # ./my_app.o 
 a = -30048 
 b = -23975 
 c = 32582 
...

See the attachments in case something is missing the code.

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


-- 
Thanks,
Nilesh
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

struct mutex timer;
static struct cdev my_cdev;
dev_t devn;
int maj = 300;
int min = 0;
int count = 1;
char modname[] = "mytimer";
short x[10] = {1,2,3,4,5,6,7,8,9,10};




ssize_t my_read(struct file *file,char *buf,size_t count,loff_t *pos) {

	unsigned long res;
	void *k = (void *)&x;
	void *l = (void *)&x+1;
	void *j = (void *)&x+2;

	mutex_lock(&timer);
	res =copy_to_user(buf,k,sizeof(short));
	res =copy_to_user(buf,l,sizeof(short));
	res =copy_to_user(buf,j,sizeof(short));

	/*res =  copy_to_user(buf,&x+4,sizeof(short));
	  res =copy_to_user(buf,&x+5,sizeof(short));
	  res =copy_to_user(buf,&x+6,sizeof(short));
	  res =copy_to_user(buf,&x+7,sizeof(short));
	  res =copy_to_user(buf,&x+8,sizeof(short));
	  res =copy_to_user(buf,&x+9,sizeof(short));
	 */
	mutex_unlock(&timer);

	return 20;

}


static struct file_operations my_fops = {
	.owner = THIS_MODULE,
	.read = my_read,

};


static int __init my_init(void){
	int ret;
	devn = MKDEV(maj,min);

	ret = register_chrdev_region(devn,count,modname);

	cdev_init(&my_cdev,&my_fops);
	cdev_add(&my_cdev,devn,count);
	mutex_init(&timer);

	printk(KERN_CRIT "Register timer maj = %d\n",maj);




	return 0;
}


static void __exit my_exit(void){

	cdev_del(&my_cdev);
	unregister_chrdev_region(devn,count);
	printk("<1> Bye Bye \n");

}


module_init(my_init);
module_exit(my_exit);
MODULE_LICENSE("Dual BSD/GPL");
#include 
#include 
#include 
#include 

int main()
{
	int nbytes ;  
	char n[20];
	short a = *((short *)&n[0]);
	short b = *((short *)&n[2]);
	short c = *((short *)&n[4]);

	int fd = open( "/dev/mytimer", O_RDONLY );
	if ( fd < 0 ) { perror( "/dev/mytimer" ); exit(1); }

	while ( 1 )
	{

		nbytes = read( fd, n, 40);
		if ( nbytes < 0 ) break;

		printf( "\r a = %d \n ", a);
		printf("\r b = %d \n",b);
		printf("\r c = %d \n",c);

		sleep(1);
		fflush( stdout );
	}
	return 0;
}
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Sound not coming after compiling new kernel 2.6.36

2010-12-23 Thread Nilesh Tayade
On Tue, 2010-12-21 at 10:11 +0530, Rishi Agrawal wrote:
> Hi All,
> 
> I compiled the kernel 2.6.36 and now the sound is missing. I have
> pasted the outputs of lsmod and lspci. I have fedora 12 installed on
> the system.
> 
> Have I done something wrong in the menuconfig stage.
> 
> Sound is coming properly with the old Fedora Kernel. 
> 
> I tried tweaking the alsamixer but it did not work.
> 
> 
> [ri...@rishi-desktop ~]$ uname -a
> Linux rishi-desktop 2.6.36 #1 SMP Sat Dec 18 21:24:34 IST 2010 i686
> i686 i386 GNU/Linux
> 
> 
> 
> [ri...@rishi-desktop ~]$ lspci | grep -i audio
> 00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High
> Definition Audio Controller (rev 02)
> 
> [ri...@rishi-desktop ~]$ lsmod | grep snd
> snd_hda_codec_analog53691  1 
> snd_hda_intel  20031  1 
> snd_hda_codec  73253  2 snd_hda_codec_analog,snd_hda_intel
> snd_hwdep   4856  1 snd_hda_codec
> snd_seq42695  0 
> snd_seq_device  4937  1 snd_seq
> snd_pcm62570  2 snd_hda_intel,snd_hda_codec
> snd_timer  15387  2 snd_seq,snd_pcm
> snd46823  11
> snd_hda_codec_analog,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_seq,snd_seq_device,snd_pcm,snd_timer,thinkpad_acpi
> snd_page_alloc  6077  2 snd_hda_intel,snd_pcm
> soundcore   4831  1 snd
> 

This may not be the case, but could you just check if pcspkr.ko module
is compiled and installed? I am no expert, but have faced similar thing
on older kernel. I have disabled the sound on my desktop by blacklisting
this module.
> 
> -- 
> Regards,
> Rishi Agrawal
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


-- 
Thanks,
Nilesh

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