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


Groups > linux.kernel > #1314003

Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support for IRQ chips

From Jon Hunter <jonathanh@nvidia.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support for IRQ chips
Date 2016-01-21 09:40 +0100
Message-ID <qTiWC-2IG-15@gated-at.bofh.it> (permalink)
References <qGErU-6H4-11@gated-at.bofh.it> <qGErV-6H4-27@gated-at.bofh.it> <qSji2-1ZW-47@gated-at.bofh.it> <qSC1l-6y1-19@gated-at.bofh.it> <qT31w-8um-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 20/01/16 15:30, Thomas Gleixner wrote:
> On Tue, 19 Jan 2016, Jon Hunter wrote:
>> On 18/01/16 14:47, Ulf Hansson wrote:
>>>> +/* Inline functions for support of irq chips that require runtime pm */
>>>> +static inline int chip_pm_get(struct irq_desc *desc)
>>>
>>> Why does these new get/put functions need to be inline functions and
>>> thus defined in the header file? Perhaps move them to manage.c are
>>> better?
>>
>> They don't have to be, and so I can move them.
> 
> Yes, please make them proper functions. The proper place for them is chip.c
>  
>>> This won't play nicely when CONFIG_PM is unset, as pm_runtime_put()
>>> would return -ENOSYS. In such cases I guess you would like to ignore
>>> the error!?
>>
>> Ok, yes good point.
> 
> So you need a CONFIG_PM variant and stubs which return 0 for the !PM case.
>  
>>>> @@ -1116,6 +1116,10 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
>>>>         if (!try_module_get(desc->owner))
>>>>                 return -ENODEV;
>>>>
>>>> +       ret = chip_pm_get(desc);
>>>> +       if (ret < 0)
>>>> +               return ret;
> 
> That leaks the module refcount.

Ok, I will fix that.

>>> I don't think using __free_irq() is the correct place to decrease the
>>> runtime PM usage count. It will keep the irqchip runtime resumed even
>>> if there are no irqs enabled for it.
>>>
>>> Instead I would rather allow the irqchip to be runtime suspended, when
>>> there are no irqs enabled on it.
> 
> Which is a no no, as you might lose interrupts that way. We disable interrupts
> lazy, i.e. we do not mask them. So no, you cannot do that from
> enable/disable_irq().
>  
>> This may appear ugly, but for something like this, we may need to have a
>> separate enable/disable API, such as
>> enable_irq_lazy()/disable_irq_lazy() which could be used to runtime
>> suspend/resume the chip and must not be used in critical sections.
> 
> enable_irq_lazy is a misnomer. enable_irq_pm or such might be acceptable.

That's fine with me.

> But before we go there I really want to see a proper use case for such
> functions.

Ok, that makes sense.

Cheers
Jon

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


Thread

Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Ulf Hansson <ulf.hansson@linaro.org> - 2016-01-18 15:50 +0100
  Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Jon Hunter <jonathanh@nvidia.com> - 2016-01-19 11:50 +0100
    Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Thomas Gleixner <tglx@linutronix.de> - 2016-01-20 16:40 +0100
      Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Jon Hunter <jonathanh@nvidia.com> - 2016-01-21 09:40 +0100
      Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Ulf Hansson <ulf.hansson@linaro.org> - 2016-01-21 13:50 +0100
        Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Thomas Gleixner <tglx@linutronix.de> - 2016-01-21 21:00 +0100
          Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Ulf Hansson <ulf.hansson@linaro.org> - 2016-01-22 12:10 +0100
            Re: [RFC PATCH V2 3/8] genirq: Add runtime power management support  for IRQ chips Thomas Gleixner <tglx@linutronix.de> - 2016-01-26 18:20 +0100

csiph-web