Re: Should I do anything about this warning?

2014-10-08 Thread Sagar Padhye
On Wed, Oct 08, 2014 at 11:33:57AM +0200, Kristof Provost wrote:
> On 2014-10-08 12:43:58 (+0530), Sagar Padhye  wrote:
> > I am new at kernel programming. I have written a driver for a custom
> > device, running on arm board. It works well (for last few months).  I
> > happen to look at kernel logs and I seen,
> > 
> > [231250.899146] WARNING: at kernel/workqueue.c:1953 
> > process_one_work+0x398/0x52c()
> > 
> You triggered a warning in the code.
Yes, I got that

> > The device is still working after this. No issues in operation. I am
> > just sceptical about analyzing this issue? Do I need to check more? If
> > yes how? with this trace?
> > 
> Yes, this indicates a potential problem.
The issue is not reproducible. Haven't seen in over 6 months. And the module is 
working just fine after the log.
Is there a way I can get more info on this e.g. more stacktrace that will end 
up in module's work function (if this occurs again)?
> You start my looking at line 1953 in kernel/workqueue.c, where you'll
> see which specific warning you're triggering.
> 
> It's probably this one:
> >   /* ensure we're on the correct CPU */
> >WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
> > raw_smp_processor_id() != pool->cpu);
They are,
1952 WARN_ON_ONCE(!(worker->flags & (WORKER_UNBOUND | WORKER_REBIND)) &&
1953  raw_smp_processor_id() != gcwq->cpu);
But I am not sure what they signify :(

Thanks,
Sagar

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


Should I do anything about this warning?

2014-10-08 Thread Sagar Padhye
Hi,
I am new at kernel programming. I have written a driver for a custom device, 
running on arm board. It works well (for last few months).
I happen to look at kernel logs and I seen,

[231250.894334] [ cut here ]
[231250.899146] WARNING: at kernel/workqueue.c:1953 
process_one_work+0x398/0x52c()
[231250.906491] Modules linked in: bcmdhd cfg80211 
[231250.911885] [] (unwind_backtrace+0x0/0x144) from [] 
(dump_stack+0x20/0x24)
[231250.920672] [] (dump_stack+0x20/0x24) from [] 
(warn_slowpath_common+0x5c/0x74)
[231250.929757] [] (warn_slowpath_common+0x5c/0x74) from [] 
(warn_slowpath_null+0x2c/0x34)
[231250.939581] [] (warn_slowpath_null+0x2c/0x34) from [] 
(process_one_work+0x398/0x52c)
[231250.949232] [] (process_one_work+0x398/0x52c) from [] 
(rescuer_thread+0x184/0x230)
[231250.958708] [] (rescuer_thread+0x184/0x230) from [] 
(kthread+0xac/0xb4)
[231250.967236] [] (kthread+0xac/0xb4) from [] 
(kernel_thread_exit+0x0/0x8)
[231250.975755] ---[ end trace 9f9c2187c0bee21b ]---

The device is still working after this. No issues in operation. I am just 
sceptical about analyzing this issue? Do I need to check more? If yes how? with 
this trace?

Thanks,
Sagar

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


Re: [PATCH] FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was not declared. Should it be static?

2013-10-02 Thread Sagar Padhye
> > I checked that cpuidle_devices is only being used in cpuidle.c - hence
> > thought that it can be made static and be removed from header.
> 
> "cpuidle_devices" is actually used in drivers/cpuidle/coupled.c as well
> so this breaks the build.

Darn! I forgot 'clean build' part. sorry.
 
> Even for "cpuidle_dev" the patch isn't right.  It doesn't fix the
> warning, for me.  The DEFINE_PER_CPU() macro defines several variables
> actually.  Per CPU variables are a bit complicated and they have to have
> globally unique names.  So just ignore the Sparse warning for per CPU
> variables.
> 

Ok, let me look at my sparse log once again, will pick some other problem (any 
suggestions?)

> There are several other "process" problems with the patch submission.
> 
> 1) Incorrect subject.  It should be:
>   [PATCH] cpuidle: make a variable static
> 
>This is based on `git log --oneline drivers/cpuidle/cpuidle.c`
>output.
> 
> 2) No blank line between subject and body of commit message.
> 3) Line wrap the body of the email at 72 characters.
> 4) No Signed-off-by line.
> 

Ok, will keep this in mind

Thanks and Regards,
Sagar 

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


[PATCH] FIXED sparse warning : drivers/cpuidle/cpuidle.c:27:1: warning: symbol 'cpuidle_dev' was not declared. Should it be static?

2013-10-02 Thread Sagar Padhye
---
This is the first (and minor) patch I am sending out, hope this is ok. I 
checked that cpuidle_devices is only being used in cpuidle.c - hence thought 
that it can be made static and be removed from header.

 drivers/cpuidle/cpuidle.c | 4 ++--
 include/linux/cpuidle.h   | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index d75040d..4826506 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -23,8 +23,8 @@
 
 #include "cpuidle.h"
 
-DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
-DEFINE_PER_CPU(struct cpuidle_device, cpuidle_dev);
+static DEFINE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
+static DEFINE_PER_CPU(struct cpuidle_device, cpuidle_dev);
 
 DEFINE_MUTEX(cpuidle_lock);
 LIST_HEAD(cpuidle_detected_devices);
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 781addc..96c8ed8 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -83,7 +83,6 @@ struct cpuidle_device {
 #endif
 };
 
-DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
 
 /**
  * cpuidle_get_last_residency - retrieves the last state's residency time
-- 
1.8.1.2


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


Re: I2C: kernel & userspace drivers : using i2c-stub

2013-04-22 Thread Sagar Padhye
I tried to use '*mknod* /dev/i2c-*0 c 89 0' and then tried to use the
device. but still when I try to use device it gives IO error (so I
concluded, I created incorrect device)*


On Mon, Apr 22, 2013 at 7:41 PM, anish singh wrote:

> does I2c-stub create the /dev node?If it is not creating then you
> have to do it yourself.
>
>
> On Mon, Apr 22, 2013 at 5:11 PM, Sagar Padhye  wrote:
>
>> Hi,
>>
>> [USING : Ubuntu 12.04 LTS]
>>
>> I am trying to learn I2C subsystem. I havent found much of well
>> documented things that can help a newbie on google. I just chose to read
>> the linux kernel documentation txts.
>>
>> I read the way kernel can interact with i2c through both SMBus calls &
>> raw file op calls (ioctl, read, write). It looks good till that point.
>>
>> The doc also tells about i2c stub. which can be used as follows:
>>  1. load the i2c module
>> 2. use i2cset (from the i2c-tools project) to pre-load some data
>> 3. load the target chip driver module
>>  4. observe its behavior in the kernel log
>>
>> I was able to achieve just the 1st step here. I loaded the module
>> successfully.
>> $ sudo modprobe i2c-stub chip_addr=0x023
>>
>> I got following Kern msg
>> $dmesg
>> ...
>> [658.071706]   i2c-stub: Virtual chip at 0x23
>>
>> So I believe that step 1 is clear.
>>
>> in second step I have no idea how to provide needed inputs to command
>> ->
>> Usage : i2cset [-f] [-y] [-m mask] I2CBUS CHIP-ADDRESS DATA-ADDRESS
>> [VALUE] [MODE]
>> I tried to give I2CBUS = 0, Chip addr = 0x23 & data addr=0 but it gives
>> error
>> Error : Could not open file '/dev/i2c-0' or '/dev/i2c/0' : No such file
>> or directory
>>
>> There is no file at all created in /dev corrosponding to this device.
>>
>> Any idea how to use i2c properly? Is this an ubuntu only problem? Can
>> anybody provide a good tutorial like thing to learn about i2c kernel &
>> userspace driver programming?
>>
>> --
>> Thanks and Regards,
>> Sagar
>>
>> ___
>> 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
>
>


-- 
Thanks and Regards,
Sagar
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


I2C: kernel & userspace drivers : using i2c-stub

2013-04-22 Thread Sagar Padhye
Hi,

[USING : Ubuntu 12.04 LTS]

I am trying to learn I2C subsystem. I havent found much of well documented
things that can help a newbie on google. I just chose to read the linux
kernel documentation txts.

I read the way kernel can interact with i2c through both SMBus calls & raw
file op calls (ioctl, read, write). It looks good till that point.

The doc also tells about i2c stub. which can be used as follows:
1. load the i2c module
2. use i2cset (from the i2c-tools project) to pre-load some data
3. load the target chip driver module
4. observe its behavior in the kernel log

I was able to achieve just the 1st step here. I loaded the module
successfully.
$ sudo modprobe i2c-stub chip_addr=0x023

I got following Kern msg
$dmesg
...
[658.071706]   i2c-stub: Virtual chip at 0x23

So I believe that step 1 is clear.

in second step I have no idea how to provide needed inputs to command
->
Usage : i2cset [-f] [-y] [-m mask] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE]
[MODE]
I tried to give I2CBUS = 0, Chip addr = 0x23 & data addr=0 but it gives
error
Error : Could not open file '/dev/i2c-0' or '/dev/i2c/0' : No such file or
directory

There is no file at all created in /dev corrosponding to this device.

Any idea how to use i2c properly? Is this an ubuntu only problem? Can
anybody provide a good tutorial like thing to learn about i2c kernel &
userspace driver programming?

-- 
Thanks and Regards,
Sagar
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies