Re: Is there a bug in dgnc.ko?

2016-02-24 Thread Navy Cheng
On Wed, Feb 24, 2016 at 05:33:11PM +0530, Sudip Mukherjee wrote:
> On Wed, Feb 24, 2016 at 5:27 PM, Navy Cheng  wrote:
> > On Tue, Feb 23, 2016 at 09:43:56PM -0800, Greg KH wrote:
> >> On Wed, Feb 24, 2016 at 12:57:42PM +0800, Navy Cheng wrote:
> >> > Hi,
> >> >
> >> > My kernel version is v4.4, and I have built drivers/staging/dgnc/dgnc.ko.
> >> > I change to *dir*/drivers/staging/dgnc and do like this:
> >> >
> >> > sudo insmod ./dgnc.ko
> >>
> >> Do you have the hardware that this driver controls?
> >
> > I'm not sure. My laptop is Dell Inspiron 14R - 5437 and I don't know if
> > there is the right hardware. I often don't know about what a driver is used
> > for in drivers/staging/. Is there any good way to know the function of a
> > driver or module?
> >
> >>
> >> > sudo lsmod | grep dgnc
> >>
> >> Does that show anything?
> >
> > Output: dgnc   65536  0
> >
> >> > sudo rmmod ./dgnc
> 
> what did dmesg showed after you did rmmod?
> 

*dmesg* show nothing after I rmmod dgnc. I guess something wrong with
dgnc_cleanup_module() which is called when dgnc is removed.


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


Mutex and Spinlock locked together

2016-02-24 Thread priyaranjan
Hello All,

Do you have any idea of a situation where we would need mutex and spinlock
to be locked together? I think there is an example for this in Linux
kernel. Can anyone help me?

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


Re: Project Idea..

2016-02-24 Thread SUNITA
Hello,

I want to measure the battery usage of various  applications in linux.
I executed powerstat and powertop tools.  Are there any other tools
which indicate the power consumption by programs in linux.

I want to calculate the power used by various scheduling programs.

Also can Sysbench be an alternative to Mibench.

Regards,
Sunita


On 2/22/16, Greg KH  wrote:
> On Mon, Feb 22, 2016 at 10:54:54AM +0530, SUNITA wrote:
>> Respected Sir/Madam,
>> I am trying to study the effect of Scheduler Policies on Energy
>> Consumption of Portable Device.
>
> There are lots of people currently working on this, and have been for
> many years.  I know of at least 3 complete implementations at the
> moment (two of which ship in some Android phones), so I would suggest
> working with one of those groups to try to get their code merged into
> the Linux kernel.  To create a 4th implementation would seem like a bit
> of a redundant effort.
>
> Search the archives of lwn.net for details about this if you are
> interested.
>
> good luck!
>
> greg k-h
>

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


Re: Is there a bug in dgnc.ko?

2016-02-24 Thread Greg KH
On Wed, Feb 24, 2016 at 07:57:01PM +0800, Navy Cheng wrote:
> On Tue, Feb 23, 2016 at 09:43:56PM -0800, Greg KH wrote:
> > On Wed, Feb 24, 2016 at 12:57:42PM +0800, Navy Cheng wrote:
> > > Hi,
> > > 
> > > My kernel version is v4.4, and I have built drivers/staging/dgnc/dgnc.ko.
> > > I change to *dir*/drivers/staging/dgnc and do like this:
> > > 
> > > sudo insmod ./dgnc.ko
> > 
> > Do you have the hardware that this driver controls?
> 
> I'm not sure. My laptop is Dell Inspiron 14R - 5437 and I don't know if
> there is the right hardware. I often don't know about what a driver is used
> for in drivers/staging/. Is there any good way to know the function of a
> driver or module?

If you don't think you have the hardware, then almost always, you don't
have the hardware, it's pretty simple :)

> > 
> > > sudo lsmod | grep dgnc
> > 
> > Does that show anything?
> 
> Output: dgnc   65536  0

Great, it loaded, then crashes when you unload, congratulations, you can
now work on fixing that bug!

good luck,

greg k-h

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


Re: user rsyslog/syslog

2016-02-24 Thread Valdis . Kletnieks
On Wed, 24 Feb 2016 14:20:23 +0200, Ran Shalit said:

> Maybe the last suggestion will be the most practical if this issue
> can't be resolved, which means that I will use one file for all logs,
> in which each line will have its own tag string according to the
> application.

No, what you do is you use an rsyslog filter on the program name,
and use that to route each program's logs to a different file.


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


Re: Does Linux kernel disables any Interrupts while going into IRQ handler?

2016-02-24 Thread jonathan nifenecker
Hi,

I'll give a try on this one, I've just getting interested in the kernel,
but have a very good knowledge of microcontroller and think I can enlighten
you with some hardware explanation on that :

when an interrupt occur and is enabled, a flag is set at the hardware level
in some interrupt flag register. (this register is set to 1 by hardware
only, the software may only clear it to 0 to acknowledge the interrupt has
been treated. It may be automatically cleared when the interrupt handler
launch the appropriate function call.)

The "mask" in your bold citation is another register, the interrupt mask
register. It allow to control temporarily the execution of particular
interrupt on a case by case basis. thus letting other interrupt occurs
while preventing a particular one. (this register is set by software, you
can think of it as an "interrupt handler inhibitor register" )

Those 2 register are wired into a bitwise AND before the signal arrived in
the interrupt handler. the interrupt handler launch the appropriate
function call corresponding to an interrupt signal received.

So because of the AND logic, if the interrupt mask bit is 0 for a specific
interrupt, the interrupt handler will see no positive edge whatever the
interrupt occurred.
BUT If the interrupt occurred, the interrupt flag will still be set to 1,
and not loose the information of an interrupt occurred.

If you set back the mask to 1, 1 AND 1 =1 the signal will then propagate to
the interrupt handler and the function call will be launch right away !


wikipedia on Mask .
What may be confuse here is that the bitwise operation can be executed
completely by the hardware (instant reactivity), so you are dealing with
mask without seeing  interrupt_flag ^ interrupt_mask anywhere in the code.

Hope that help.


Jonathan

2016-02-24 13:14 GMT+01:00 priyaranjan :

> When an Interrupt occurs most device drivers creates a critical section
> using spin_lock_irqsave or spin_lock_irq which disables the interrupt.
>
> In such a case the Interrupts are disabled by the IRQ handler. My question
> is whether Linux kernel disables any interrupts just when the IRQ handler
> executes or it just wait for the IRQ handler programmer to disable the IRQ
> in whatever way?
>
> My understanding is that Russel King has implemented IRQ_DISABLED, If this
> flag is set then only the IRQ that has occurred is disabled lately however
> enabled automatically by Kernel after IRQ handler finishes. Is that
> correct? This also happens in delayed manner.Can anyone explain me how
> exactly the IRQ disabling is delayed?
>
> From free-electrons link
> ,
> what I read is :-
>
> *The interrupt is kept enabled and is masked in the flow handler when an
> interrupt event happens*. This prevents losing edge interrupts on
> hardware which does not store an edge interrupt event while the interrupt
> is disabled at the hardware level.
>
> Can anyone please explain the bold line here?
>
> Regards,
>
> Priyaranjan
>
> ___
> 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: Porting to an S3C2416 failed with no console message

2016-02-24 Thread Woody Wu
On Wednesday, February 24, 2016, nick  wrote:

>
>
> On 2016-02-23 09:35 AM, Woody Wu wrote:
> > Hi,
> >
> > I am trying to port 3.18 kernel to a S3C2416.  Years ago, a guy helped me
> > ported a 3.1.0 kernel to the same board, and the guy left and the kernel
> > got too old. The guy also ported an u-boot as boot loader to load the
> 3.1.0
> > kernel.  I had the source code of the ported u-boot and the 3.1.0 linux.
> >
> > Now, my problem is that my porting of 3.18 seems not working, I did not
> see
> > any kernel message printed to the first SoC serial port as I expected. As
> > long as I can get kernel message printed to the serial, I think I can
> step
> > by step finish the whole porting work eventually. But now, there is no
> > message and I have no other hardware debugging tools and knowledges, I
> felt
> > I lost my way totally.
> >
> > I hope someone can give me some suggestions, clues to help me
> > understand where to check and what's the possible causes.
> >
> Firstly my knowledge with kernel upstream porting to a non mainlined
> port is not as good as some of the other people here but let's see what
> I can do.

> Since I found the old porting of the 3.1.0 is quit similar to SMDK2416,
> > then I started my work from also the SMDK2416 board code in 3.18.
> > Basically, I defined the machine-code to match that passed from u-boot,
> and
> > copied the MACHINE-START definition section with removing of some
> > not-immediately-needed stuff such as USB, NAND and HMSUI etc. I also
> > enabled the S3C2410 serial driver and enabled the serial console
> supporting
> > for the Samsung SoC. Of course, I had the kernel parameter of
> > "console=ttySAC0", ttySAC0 is the Linux device name of the first UART
> port
> > in the SoC. These are basically what I had done and I guess the SoC
> serial
> > part between my board and SMDK2416 should be very similar and the kernel
> > should at least be able to print it's first message then I should have
> > chance to fix other differences. But there is no kernel message at all
> as I
> > mentioned above.
> >

Can you either send me the patch series that the other developer used to
> port
> your port to 3.1.0 or I would recommend stating on kernel 3.1.0 as it's
> still
> a longterm kernel unless you have reason to upgrade. If you do I would
> recommend
> you either get something with experience or yourself to try and upstream
> the
> differences between your board and the mainline so others will not have to
> do
> the same work as you unless your company will not allow you to do this.
> > What should I check for the problem usually? Is there a checking list to
> go
> > through? I hope you experts can give me some clues.  Thanks in advance!
> >


To make a patch, I have to have the original 3.1.0, but I was confused
about how the kernel.org organized, I just cannot find how to get a 3.1.0
tarball or git repository.  Can you please give me a hint?  BTW, I also
dont really understand what the 'mainline' mens. If I download a latest
3.18.27.tar.xz,  is it a mainline?


> Their are two things you can do here either try and enable early_printk as
> this
> seems to be happening before the serial console is able to print the first
> kernel
> message. The second is trying to enable kgdb on the board and use another
> computer
> over the serial port to do this sort of debugging.
> Hope this gets you started,
> Nick


Firstly, I will try early_printk soon.  Before that, can your tell me what
are differences betweenthe following printing technologies: 1, early_printk
2, early_print, 3, putc used in arch/arm/compressed/misc.c.

Secondly, I have a question about kgdb.  You see the situation is that my
serial port had been initialized by the u-boot, but not yet touched by the
kernel since the kernel is not yet run and waiting for debugging, and now I
am jusr sitting in the u-boot command prompt and has an uImage kernel image
file loaded in a region of SDRAM, do you think that these all above are
enough or possible to the kgdb debugging?

Many thanks!

> Best Regards,
> > woody
> >
> >
> >
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org 
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>


-- 
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer

woody
public key at http://subkeys.pgp.net:11371 (narkewo...@gmail.com)
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: user rsyslog/syslog

2016-02-24 Thread Ran Shalit
On Wed, Feb 24, 2016 at 10:17 AM,   wrote:
> On Wed, 24 Feb 2016 09:36:54 +0200, Ran Shalit said:
>
>> I am trying to write to rsyslog from application.
>> With openlog(..., LOG_USER), it works fine and I find the log in
>> /var/log/user.log (it is defines in /etc/rsyslog.d/50-defaults.conf )
>> But we need to enable different applications to have each its own log file.
>> I tried to use LOG_LOCAL0 instead and configured it in
>> /etc/rsyslog.d/50-defaults.conf the same way as user:
>>
>> local0.* action
>> {
>>   type="omfile"
>>  FILE="/var/log/local0.log"
>>  FileOwner="root"
>>  FileGroup="adm"
>>
>> }
>>
>> I then did
>> 1. /etc/init.d/rsyslog stop
>> 2. /etc/init.d/rsyslog start
>> I see no warnings or errors, and I started the application trying to
>> write to LOG_LOCAL0, But there is no new file created, no logs.
>>
>> Is there any idea whatws wrong, or how I can achieve this multi user's logs ?
>
> Not really a kernel issue, is it?  But anyhow
>
> First thing to do is to make sure your code checks the return code
> from openlog().
>
> The next thing to check is that your application is actually trying to
> log to LOCAL0.  Using the debugging tool of your choice, ensure that control
> flow reaches the syslog() statement. Make sure that it's using LOCAL0.
>
> Define an action for *.* dumping to /var/log/everything.log - does your
> message show up in there?
>
> In other words, all the usual userspace debugging.. start at the beginning
> and trace through the flow.
>
> And since rsyslog allows regex matching, maybe you should be letting all the
> applications continue logging to LOG_USER, and then use filters
> of the form 'programname startswith app1', 'programname startswith app2',
> and so on to select based on the program name.
>
Hi Vladis,

Thanks a lot.
I see that openlog has not retuen value, and it seems that only
openlog get the LOG_USER (or LOG_LOCAL0) arguments.
the other functions such as syslog does not use it at all, for example:

openlog("Logs", "", LOG_USER);
syslog(LOG_INFO, "Start logging");
closelog();

Anyway, on debugging I seet that these routines are called, but
nothing gets into the expected localX files. It only works with the
USER file.

Maybe the last suggestion will be the most practical if this issue
can't be resolved, which means that I will use one file for all logs,
in which each line will have its own tag string according to the
application.

Thanks,
Ran

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


Does Linux kernel disables any Interrupts while going into IRQ handler?

2016-02-24 Thread priyaranjan
When an Interrupt occurs most device drivers creates a critical section
using spin_lock_irqsave or spin_lock_irq which disables the interrupt.

In such a case the Interrupts are disabled by the IRQ handler. My question
is whether Linux kernel disables any interrupts just when the IRQ handler
executes or it just wait for the IRQ handler programmer to disable the IRQ
in whatever way?

My understanding is that Russel King has implemented IRQ_DISABLED, If this
flag is set then only the IRQ that has occurred is disabled lately however
enabled automatically by Kernel after IRQ handler finishes. Is that
correct? This also happens in delayed manner.Can anyone explain me how
exactly the IRQ disabling is delayed?

>From free-electrons link
,
what I read is :-

*The interrupt is kept enabled and is masked in the flow handler when an
interrupt event happens*. This prevents losing edge interrupts on hardware
which does not store an edge interrupt event while the interrupt is
disabled at the hardware level.

Can anyone please explain the bold line here?

Regards,

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


Re: Is there a bug in dgnc.ko?

2016-02-24 Thread Navy Cheng
On Wed, Feb 24, 2016 at 12:37:40AM -0500, valdis.kletni...@vt.edu wrote:
> On Wed, 24 Feb 2016 12:57:42 +0800, Navy Cheng said:
> > Hi,
> >
> > My kernel version is v4.4, and I have built drivers/staging/dgnc/dgnc.ko.
> > I change to *dir*/drivers/staging/dgnc and do like this:
> >
> > sudo insmod ./dgnc.ko
> 
> What output, if any, did this generate?

No output. I use *dmesg* to find more information:

[  572.915977] dgnc: module is from the staging directory, the quality is
   unknown, you have been warned.

> > sudo lsmod | grep dgnc
> 
> Again, what messages?

Output:
dgnc   65536  0

> > sudo rmmod ./dgnc
> 
> Again, what happened?

No output. After *dmesg*, no more info in the ring buffer.

> > sudo insmod ./dgnc.ko
> 
> And here?

No output. 


> > After I re-insmod the dgnc module, my laptop is breakdown.
>
> What does "breakdown" mean?  Did it hang entirely? Did you get a message
> in your dmesg output and/or on the console?  Other?

The GUI stop work and any key in my laptop is not work. The *Caps Lock lamp*
in the keyboard is flashing.

> > My OS is debian 8.0. Is there a bug in dgnc.ko or something wrong with my
> > OS or kernel. If there is a bug, How can I find it?
> 
> Start by providing enough info to see if there's a bug.



> ___
> 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: Is there a bug in dgnc.ko?

2016-02-24 Thread Sudip Mukherjee
On Wed, Feb 24, 2016 at 5:27 PM, Navy Cheng  wrote:
> On Tue, Feb 23, 2016 at 09:43:56PM -0800, Greg KH wrote:
>> On Wed, Feb 24, 2016 at 12:57:42PM +0800, Navy Cheng wrote:
>> > Hi,
>> >
>> > My kernel version is v4.4, and I have built drivers/staging/dgnc/dgnc.ko.
>> > I change to *dir*/drivers/staging/dgnc and do like this:
>> >
>> > sudo insmod ./dgnc.ko
>>
>> Do you have the hardware that this driver controls?
>
> I'm not sure. My laptop is Dell Inspiron 14R - 5437 and I don't know if
> there is the right hardware. I often don't know about what a driver is used
> for in drivers/staging/. Is there any good way to know the function of a
> driver or module?
>
>>
>> > sudo lsmod | grep dgnc
>>
>> Does that show anything?
>
> Output: dgnc   65536  0
>
>> > sudo rmmod ./dgnc

what did dmesg showed after you did rmmod?

regards
sudip

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


Re: Is there a bug in dgnc.ko?

2016-02-24 Thread Navy Cheng
On Tue, Feb 23, 2016 at 09:43:56PM -0800, Greg KH wrote:
> On Wed, Feb 24, 2016 at 12:57:42PM +0800, Navy Cheng wrote:
> > Hi,
> > 
> > My kernel version is v4.4, and I have built drivers/staging/dgnc/dgnc.ko.
> > I change to *dir*/drivers/staging/dgnc and do like this:
> > 
> > sudo insmod ./dgnc.ko
> 
> Do you have the hardware that this driver controls?

I'm not sure. My laptop is Dell Inspiron 14R - 5437 and I don't know if
there is the right hardware. I often don't know about what a driver is used
for in drivers/staging/. Is there any good way to know the function of a
driver or module?

> 
> > sudo lsmod | grep dgnc
> 
> Does that show anything?

Output: dgnc   65536  0

> > sudo rmmod ./dgnc
> > sudo insmod ./dgnc.ko
> > 
> > After I re-insmod the dgnc module, my laptop is breakdown.
> 
> Then there's a bug to fix in the driver, it must not clean up everything
> properly.  Based on a quick read of it, there is lots of things that
> need to be fixed in it, that's why it is in staging.  If you are
> interested, I would suggest fixing this issue would be a great start.

I'm very glad to get your advice to fix this issue. As a kernelnewbies, I
have sent two patches about code cleaning to you, and they are merged to
the kernel tree. I realy interested to fix this bug to improve my
understanding of the kerenl.

Thank you.


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


Re: Partial (?) kernel crash dump ?

2016-02-24 Thread Mulyadi Santosa
On Wed, Feb 24, 2016 at 11:11 AM, Rolland Santimano <
rolland.santim...@gmail.com> wrote:

> I'm trying to save a crashdump on a DellFC630 with 128G of RAM,
> running Ubuntu 14.10, kernel 3.16.0-23-generic; used to host a bunch
> of KVM-style VMs.
>
> Since saving the full dump is taking forever & a day, I'm looking to
> save a partial dump -- maybe a few addr space regions only from the
> kernel VAS.
>
> Is this even possible ? Any other options ? Or am I missing something here
> ?
>
> --
> Rolland
>
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

try to read this:
http://events.linuxfoundation.org/sites/events/files/slides/slide_final_0.pdf

It might be not what you're looking for, but IMHO worth to read


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

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

This email has been sent from a virus-free computer protected by Avast.
www.avast.com 
<#DDB4FAA8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: user rsyslog/syslog

2016-02-24 Thread Valdis . Kletnieks
On Wed, 24 Feb 2016 09:36:54 +0200, Ran Shalit said:

> I am trying to write to rsyslog from application.
> With openlog(..., LOG_USER), it works fine and I find the log in
> /var/log/user.log (it is defines in /etc/rsyslog.d/50-defaults.conf )
> But we need to enable different applications to have each its own log file.
> I tried to use LOG_LOCAL0 instead and configured it in
> /etc/rsyslog.d/50-defaults.conf the same way as user:
>
> local0.* action
> {
>   type="omfile"
>  FILE="/var/log/local0.log"
>  FileOwner="root"
>  FileGroup="adm"
>
> }
>
> I then did
> 1. /etc/init.d/rsyslog stop
> 2. /etc/init.d/rsyslog start
> I see no warnings or errors, and I started the application trying to
> write to LOG_LOCAL0, But there is no new file created, no logs.
>
> Is there any idea whatws wrong, or how I can achieve this multi user's logs ?

Not really a kernel issue, is it?  But anyhow

First thing to do is to make sure your code checks the return code
from openlog().

The next thing to check is that your application is actually trying to
log to LOCAL0.  Using the debugging tool of your choice, ensure that control
flow reaches the syslog() statement. Make sure that it's using LOCAL0.

Define an action for *.* dumping to /var/log/everything.log - does your
message show up in there?

In other words, all the usual userspace debugging.. start at the beginning
and trace through the flow.

And since rsyslog allows regex matching, maybe you should be letting all the
applications continue logging to LOG_USER, and then use filters
of the form 'programname startswith app1', 'programname startswith app2',
and so on to select based on the program name.



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