Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507997

Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook

From Lukas Wunner <lukas@wunner.de>
Newsgroups linux.kernel
Subject Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook
Date 2016-10-25 08:20 +0200
Message-ID <sw3fz-1Qe-1@gated-at.bofh.it> (permalink)
References (2 earlier) <svqed-Xq-9@gated-at.bofh.it> <svspI-2hg-11@gated-at.bofh.it> <svJAd-5Aj-5@gated-at.bofh.it> <svKmB-67t-3@gated-at.bofh.it> <svLiG-6PQ-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Oct 24, 2016 at 02:05:45PM +0300, Andy Shevchenko wrote:
> On Mon, 2016-10-24 at 12:09 +0200, Lukas Wunner wrote:
> > I note that you're exporting intel_mid_pci_set_power_state() even
> > though there's currently no module user, so perhaps you're intending
> > to call the function from somewhere else.
> 
> The export there is purely dictated by leaving abstract stuff under
> drivers/pci when platform code is kept under arch/x86/platform. Other
> than that there is no plans to call this outside of pci-mid.c.

The PCI core, including pci-mid.o, is linked into vmlinux, not a module,
and exporting is only needed for module users.  A commit to unexport the
symbol has been sitting on my development branch for 2 weeks, I delayed
it because I wanted to wait for the regression to be fixed first.
Sending out now since the topic has come up.


> > > > The usage of a mutex in mid_pwr_set_power_state() actually seems
> > > > questionable since this is called with interrupts disabled:
> > > > 
> > > > pci_pm_resume_noirq
> > > >   pci_pm_default_resume_early
> > > >     pci_power_up
> > > >       platform_pci_set_power_state
> > > >         mid_pci_set_power_state
> > > >           intel_mid_pci_set_power_state
> > > >             mid_pwr_set_power_state
> > > 
> > > Hmm... I have to look at this closer. I don't remember why I put
> > > mutex
> > > in the first place there. Anyway it's another story.
> 
> There are two code paths
> pci_power_up()
> pci_platform_power_transition()
> 
> Second one can be called in non-atomic context for sure (consider
> standard ->resume() callback).
> 
> First one runs when IRQ disabled on CPU side.
> 
> In any case we probably need to serialize access in our code to protect
> against several PCI devices being powered up simultaneously.

Right, good point, the PM core will indeed parallelize suspend/resume
of the devices, so if __update_power_state() cannot be safely called
concurrently for different devices (I don't know if that's the case)
then indeed you need locking (with spinlocks).  It might be worth
pondering if the locking should happen further down in the call stack
because I assume the critical section would really just be in
__update_power_state().

Best regards,

Lukas

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops Lukas Wunner <lukas@wunner.de> - 2016-10-23 14:00 +0200
  [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops  ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-23 14:00 +0200
    Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-10-23 14:40 +0200
      Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-23 17:00 +0200
        Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-10-23 18:20 +0200
        Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-24 11:20 +0200
          Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-24 12:10 +0200
            Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-24 13:10 +0200
              Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-25 08:20 +0200
                Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-10-26 16:00 +0200
                Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit  pci_platform_pm_ops ->get_state hook Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-26 17:10 +0200

csiph-web