All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@ring0.de>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Anton Vorontsov <anton@enomsg.org>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Tony Lindgren <tony@atomide.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-kernel@vger.kernel.org,
	Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
	freemangordon@abv.bg, aaro.koskinen@iki.fi, pavel@ucw.cz
Subject: Re: [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode
Date: Sun, 19 Jan 2014 21:54:03 +0100	[thread overview]
Message-ID: <20140119205402.GA24185@earth.universe> (raw)
In-Reply-To: <CAOf5uwnz6SfeEsbGq62QFgRHJ2ys++VV1+VrULxyR4uH2Z_vJQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3830 bytes --]

On Mon, Dec 02, 2013 at 02:45:06AM +0100, Michael Trimarchi wrote:
> On Mon, Dec 2, 2013 at 1:24 AM, Anton Vorontsov <anton@enomsg.org> wrote:
> > On Mon, Dec 02, 2013 at 01:02:40AM +0100, Michael Trimarchi wrote:
> >> On Sun, Dec 1, 2013 at 11:37 PM, Anton Vorontsov <anton@enomsg.org> wrote:
> >> > On Mon, Nov 25, 2013 at 08:16:34PM +0100, Michael Trimarchi wrote:
> >> > ...
> >> >> >> So you can read this value without any type of synchronization
> >> >> >> with the power_supply_core
> >> >> >> and sysfs implementation?
> >> > ...
> >> >> https://lists.ubuntu.com/archives/kernel-team/2013-January/025206.html
> >> >>
> >> >> I found and equivalent scenario that I was trying to said
> >> >
> >> > That's a good question, actually. Even though in Pali's case the notifier
> >> > is atomic (so that we are pretty confident that the object won't be
> >> > unregistered), there is still a possiblity of a dead lock, for example. So
> >>
> >> So if the get_property is a sleeping function it will be a deadlock. Right?
> >
> > All kind of bad things might happen, yes. But before that I would expect a
> > bunch of warnings from might_sleep() stuff.
> >
> > I would recommend to test the patches using preempt/smp kernels + various
> > DEBUG_ kernel options set.
> >
> 
> Is it more simple to make it not atomic and use a mutex in get_property?

I just built a kernel with CONFIG_DEBUG_ATOMIC_SLEEP to test another
driver and got the following output for bq2415x:

[    7.667449] Workqueue: events power_supply_changed_work
[    7.673034] [<c0015c28>] (unwind_backtrace+0x0/0xe0) from [<c0011e1c>] (show_stack+0x10/0x14)
[    7.682098] [<c0011e1c>] (show_stack+0x10/0x14) from [<c052cdd0>] (dump_stack+0x78/0xac)
[    7.690704] [<c052cdd0>] (dump_stack+0x78/0xac) from [<c052a044>] (__schedule_bug+0x48/0x60)
[    7.699645] [<c052a044>] (__schedule_bug+0x48/0x60) from [<c053071c>] (__schedule+0x74/0x638)
[    7.708618] [<c053071c>] (__schedule+0x74/0x638) from [<c05301fc>] (schedule_timeout+0x1dc/0x24c)
[    7.718017] [<c05301fc>] (schedule_timeout+0x1dc/0x24c) from [<c05316ec>] (wait_for_common+0x138/0x17c)
[    7.727966] [<c05316ec>] (wait_for_common+0x138/0x17c) from [<c0362a70>] (omap_i2c_xfer+0x340/0x4a0)
[    7.737640] [<c0362a70>] (omap_i2c_xfer+0x340/0x4a0) from [<c035d928>] (__i2c_transfer+0x40/0x74)
[    7.747039] [<c035d928>] (__i2c_transfer+0x40/0x74) from [<c035e22c>] (i2c_transfer+0x6c/0x90)
[    7.756195] [<c035e22c>] (i2c_transfer+0x6c/0x90) from [<c037ad24>] (bq2415x_i2c_write+0x48/0x78)
[    7.765563] [<c037ad24>] (bq2415x_i2c_write+0x48/0x78) from [<c037ae60>] (bq2415x_set_weak_battery_voltage+0x4c/0x50)
[    7.776824] [<c037ae60>] (bq2415x_set_weak_battery_voltage+0x4c/0x50) from [<c037bce8>] (bq2415x_set_mode+0xdc/0x14c)
[    7.788085] [<c037bce8>] (bq2415x_set_mode+0xdc/0x14c) from [<c037bfb8>] (bq2415x_notifier_call+0xa8/0xb4)
[    7.798309] [<c037bfb8>] (bq2415x_notifier_call+0xa8/0xb4) from [<c005f228>] (notifier_call_chain+0x38/0x68)
[    7.808715] [<c005f228>] (notifier_call_chain+0x38/0x68) from [<c005f284>] (__atomic_notifier_call_chain+0x2c/0x3c)
[    7.819732] [<c005f284>] (__atomic_notifier_call_chain+0x2c/0x3c) from [<c005f2a8>] (atomic_notifier_call_chain+0x14/0x18)
[    7.831420] [<c005f2a8>] (atomic_notifier_call_chain+0x14/0x18) from [<c0378078>] (power_supply_changed_work+0x6c/0xb8)
[    7.842864] [<c0378078>] (power_supply_changed_work+0x6c/0xb8) from [<c00556c0>] (process_one_work+0x248/0x440)
[    7.853546] [<c00556c0>] (process_one_work+0x248/0x440) from [<c0055d6c>] (worker_thread+0x208/0x350)
[    7.863372] [<c0055d6c>] (worker_thread+0x208/0x350) from [<c005b0ac>] (kthread+0xc8/0xdc)
[    7.872131] [<c005b0ac>] (kthread+0xc8/0xdc) from [<c000e138>] (ret_from_fork+0x14/0x3c)

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-01-19 20:54 UTC|newest]

Thread overview: 155+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08  8:50 [PATCH 0/4] Add support for charging battery in Nokia RX-51 Pali Rohár
2013-09-08  8:50 ` Pali Rohár
2013-09-08  8:50 ` [PATCH 1/4] usb: musb: Call atomic_notifier_call_chain when status is changed Pali Rohár
2013-09-08  8:50   ` Pali Rohár
2013-09-17 15:48   ` Felipe Balbi
2013-09-17 15:48     ` Felipe Balbi
2013-09-17 15:48     ` Felipe Balbi
2013-09-17 15:49   ` Felipe Balbi
2013-09-17 15:49     ` Felipe Balbi
2013-09-17 15:49     ` Felipe Balbi
2013-09-17 16:05     ` Pali Rohár
2013-09-17 16:05       ` Pali Rohár
2013-09-17 16:05       ` Pali Rohár
2013-09-17 16:08       ` Felipe Balbi
2013-09-17 16:08         ` Felipe Balbi
2013-09-17 16:08         ` Felipe Balbi
2013-09-17 19:28         ` Pali Rohár
2013-09-17 19:28           ` Pali Rohár
2013-09-18  1:49           ` Felipe Balbi
2013-09-18  1:49             ` Felipe Balbi
2013-09-18  1:49             ` Felipe Balbi
2013-09-18  8:20             ` Pali Rohár
2013-09-18  8:20               ` Pali Rohár
2013-09-18  8:20               ` Pali Rohár
2013-09-18  9:04               ` Javier Martinez Canillas
2013-09-18  9:04                 ` Javier Martinez Canillas
2013-09-18  9:04                 ` Javier Martinez Canillas
2013-09-18 13:30                 ` Pavel Machek
2013-09-18 13:30                   ` Pavel Machek
2013-09-18 13:57                   ` Javier Martinez Canillas
2013-09-18 13:57                     ` Javier Martinez Canillas
2013-09-18 14:22                     ` Pavel Machek
2013-09-18 14:22                       ` Pavel Machek
2013-09-18 14:35                       ` Pavel Machek
2013-09-18 14:35                         ` Pavel Machek
2013-09-18 16:25                         ` Felipe Balbi
2013-09-18 16:25                           ` Felipe Balbi
2013-09-18 16:25                           ` Felipe Balbi
2013-09-18 14:53                       ` Javier Martinez Canillas
2013-09-18 14:53                         ` Javier Martinez Canillas
2013-09-18 15:56                     ` Pali Rohár
2013-09-18 15:56                       ` Pali Rohár
2013-09-18 15:56                       ` Pali Rohár
2013-09-18 16:36                       ` Felipe Balbi
2013-09-18 16:36                         ` Felipe Balbi
2013-09-18 16:36                         ` Felipe Balbi
2013-09-18 16:43                         ` Pali Rohár
2013-09-18 16:43                           ` Pali Rohár
2013-09-18 16:43                           ` Pali Rohár
2013-09-18 16:48                           ` Felipe Balbi
2013-09-18 16:48                             ` Felipe Balbi
2013-09-18 16:48                             ` Felipe Balbi
2013-09-18 17:03                             ` [PATCH usb 1/2] usb: musb: Add missing ATOMIC_INIT_NOTIFIER_HEAD Pali Rohár
2013-09-18 17:03                               ` Pali Rohár
2013-09-18 17:03                               ` Pali Rohár
2013-09-25  8:17                               ` Pali Rohár
2013-09-25  8:17                                 ` Pali Rohár
2013-09-25  8:17                                 ` Pali Rohár
2013-09-25 20:33                                 ` Felipe Balbi
2013-09-25 20:33                                   ` Felipe Balbi
2013-09-25 20:33                                   ` Felipe Balbi
2013-09-26  0:00                                   ` Pavel Machek
2013-09-26  0:00                                     ` Pavel Machek
2013-10-01 14:22                                     ` Felipe Balbi
2013-10-01 14:22                                       ` Felipe Balbi
2013-10-01 14:22                                       ` Felipe Balbi
2013-09-18 17:03                             ` [PATCH usb 2/2] usb: musb: Call atomic_notifier_call_chain when status is changed Pali Rohár
2013-09-18 17:03                               ` Pali Rohár
2013-09-18 17:03                               ` Pali Rohár
2013-09-08  8:50 ` [PATCH 2/4] power: isp1704_charger: Fix driver to work with changes introduced in v3.5 Pali Rohár
2013-09-08  8:50   ` Pali Rohár
2013-10-22 21:03   ` Anton Vorontsov
2013-10-22 21:03     ` Anton Vorontsov
2013-09-08  8:50 ` [PATCH 3/4] power: isp1704_charger: Add callback function set_current Pali Rohár
2013-09-08  8:50   ` Pali Rohár
2013-09-08  8:50 ` [PATCH 4/4] RX-51: Add platform function and data for bq24150a charger Pali Rohár
2013-09-08  8:50   ` Pali Rohár
2013-09-09 13:39   ` Sebastian Reichel
2013-09-09 13:39     ` Sebastian Reichel
2013-09-20 19:22   ` Pali Rohár
2013-09-20 19:22     ` Pali Rohár
2013-09-23 18:03     ` Tony Lindgren
2013-09-23 18:03       ` Tony Lindgren
2013-09-23 19:16       ` Pali Rohár
2013-09-23 19:16         ` Pali Rohár
2013-09-23 20:00         ` Sebastian Reichel
2013-09-23 20:00           ` Sebastian Reichel
2013-09-23 20:06           ` Pali Rohár
2013-09-23 20:06             ` Pali Rohár
2013-09-23 20:47             ` Sebastian Reichel
2013-09-23 20:47               ` Sebastian Reichel
2013-09-23 23:11               ` Tony Lindgren
2013-09-23 23:11                 ` Tony Lindgren
2013-09-24  0:05               ` Pavel Machek
2013-09-24  0:05                 ` Pavel Machek
2013-09-24 17:05               ` Pali Rohár
2013-09-24 17:05                 ` Pali Rohár
2013-09-24 20:50                 ` Sebastian Reichel
2013-09-24 20:50                   ` Sebastian Reichel
2013-09-14  9:38 ` [PATCH 0/4] Add support for charging battery in Nokia RX-51 Pali Rohár
2013-09-14  9:38   ` Pali Rohár
2013-09-21 13:42 ` Pali Rohár
2013-09-21 13:42   ` Pali Rohár
2013-11-19 10:18 ` [PATCH v2 0/3] " Pali Rohár
2013-11-19 10:18   ` [PATCH v2 1/3] power_supply: Add power_supply notifier Pali Rohár
2013-11-19 13:10     ` Pavel Machek
2013-11-19 13:19       ` Pali Rohár
2013-11-24 17:02     ` Sebastian Reichel
2013-11-27 17:23     ` Tc, Jenny
2013-11-27 17:23       ` Tc, Jenny
2013-12-01 22:20       ` Anton Vorontsov
2013-12-01 22:23     ` Anton Vorontsov
2013-12-01 22:23       ` Anton Vorontsov
2014-01-03 11:09       ` Tc, Jenny
2014-01-03 11:09         ` Tc, Jenny
2014-01-03 16:02         ` Anton Vorontsov
2013-11-19 10:18   ` [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode Pali Rohár
2013-11-19 13:24     ` Pavel Machek
2013-12-24  1:58       ` Anton Vorontsov
2013-11-24 17:00     ` Sebastian Reichel
2013-11-24 19:01       ` Pali Rohár
2013-11-24 19:26         ` Sebastian Reichel
2013-11-24 19:41           ` Pali Rohár
2013-11-24 21:00             ` Sebastian Reichel
2013-11-25 14:01             ` Pavel Machek
2013-11-25 14:10               ` Pali Rohár
2013-11-25 15:18                 ` Pavel Machek
2013-11-25 18:52                   ` Pali Rohár
2013-11-24 17:18     ` Michael Trimarchi
2013-11-24 17:18       ` Michael Trimarchi
2013-11-24 19:01       ` Pali Rohár
2013-11-25 19:16         ` Michael Trimarchi
2013-11-25 19:16           ` Michael Trimarchi
2013-12-01 22:37           ` Anton Vorontsov
2013-12-02  0:02             ` Michael Trimarchi
2013-12-02  0:24               ` Anton Vorontsov
2013-12-02  1:45                 ` Michael Trimarchi
2014-01-19 20:54                   ` Sebastian Reichel [this message]
2014-01-19 20:56                     ` Michael Trimarchi
2014-01-20 10:21                     ` Russell King - ARM Linux
2014-01-20 11:24                       ` Sebastian Reichel
2013-12-06 13:32     ` Pali Rohár
2013-11-19 10:18   ` [PATCH v2 3/3] RX-51: Add platform data for bq24150a charger Pali Rohár
2013-11-19 13:32     ` Pavel Machek
2013-11-24 10:28       ` Pali Rohár
2013-11-19 14:44   ` [PATCH v2 0/3] Add support for charging battery in Nokia RX-51 Sebastian Reichel
2013-11-19 15:40     ` Tony Lindgren
2013-11-19 21:38     ` Pali Rohár
2013-11-25 17:01 [PATCH v2 2/3] bq2415x_charger: Use power_supply notifier for automode Ивайло Димитров
2013-11-25 17:14 ` Sebastian Reichel
2013-11-25 18:32 Ивайло Димитров
2013-11-25 21:50 ` Sebastian Reichel
2013-11-27 21:16   ` Pali Rohár
2013-11-28  0:25     ` Sebastian Reichel
2013-11-28  6:53       ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140119205402.GA24185@earth.universe \
    --to=sre@ring0.de \
    --cc=aaro.koskinen@iki.fi \
    --cc=anton@enomsg.org \
    --cc=dwmw2@infradead.org \
    --cc=freemangordon@abv.bg \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=michael@amarulasolutions.com \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.