All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqdomain: handle the per-CPU irq trigger type settings
@ 2017-03-10  4:52 gengdongjiu
  2017-03-10 10:35 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: gengdongjiu @ 2017-03-10  4:52 UTC (permalink / raw
  To: tglx, jason, benh, linux-kernel, zhanghaibin7, huangshaoyu

    when devices parse and map an per-cpu interrupt into linux virq space
    using irq_of_parse_and_map API, it will always be failed if needs to set
    the specified irq trigger type, because irq_set_irq_type is only for 1-N
    mode interrupt source, not for per-cpu interrupt source. so handle per-cpu
    IRQs for this failure.

    Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
                   Zhanghai bin <zhanghaibin7@huawei.com>

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 9fd618d..8116cf2 100755
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -542,8 +542,16 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)

        /* Set type if specified and different than the current one */
        if (type != IRQ_TYPE_NONE &&
-           type != irq_get_trigger_type(virq))
-               irq_set_irq_type(virq, type);
+           type != irq_get_trigger_type(virq)) {
+               int ret = 0;
+               struct irq_data *irq_data = irq_get_irq_data(virq);
+
+               ret = irq_set_irq_type(virq, type);
+
+                /* Handle per-cpu IRQ: just save type in irq_data */
+               if (-EINVAL == ret && irq_data)
+                       irqd_set_trigger_type(irq_data, type);
+       }
        return virq;
 }
 EXPORT_SYMBOL_GPL(irq_create_of_mapping);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] irqdomain: handle the per-CPU irq trigger type settings
  2017-03-10  4:52 [PATCH] irqdomain: handle the per-CPU irq trigger type settings gengdongjiu
@ 2017-03-10 10:35 ` Thomas Gleixner
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2017-03-10 10:35 UTC (permalink / raw
  To: gengdongjiu; +Cc: jason, benh, linux-kernel, zhanghaibin7, huangshaoyu


On Fri, 10 Mar 2017, gengdongjiu wrote:

>     when devices parse and map an per-cpu interrupt into linux virq space
>     using irq_of_parse_and_map API, it will always be failed if needs to set
>     the specified irq trigger type, because irq_set_irq_type is only for 1-N
>     mode interrupt source, not for per-cpu interrupt source. so handle per-cpu
>     IRQs for this failure.

Please format your changelogs proper into sections:

1) Context

2) Problem

3) Solution

Writing one big lump of a sentence is just unreadable.

Aside of that:

1) No indentation of the changelog
2) Sentences start with upper case letters
3) Function references want () after the function name

Aside

> 
>     Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>                    Zhanghai bin <zhanghaibin7@huawei.com>

That SOB is bogus.

> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 9fd618d..8116cf2 100755
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -542,8 +542,16 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
> 
>         /* Set type if specified and different than the current one */
>         if (type != IRQ_TYPE_NONE &&
> -           type != irq_get_trigger_type(virq))
> -               irq_set_irq_type(virq, type);
> +           type != irq_get_trigger_type(virq)) {
> +               int ret = 0;
> +               struct irq_data *irq_data = irq_get_irq_data(virq);
> +
> +               ret = irq_set_irq_type(virq, type);
> +
> +                /* Handle per-cpu IRQ: just save type in irq_data */
> +               if (-EINVAL == ret && irq_data)
> +                       irqd_set_trigger_type(irq_data, type);

This is completely broken. That stores a trigger type for any interrupt if
the set type function fails.

You fail to explain

    - WHY irq_set_irq_type() fails for these per cpu interrupts
    
    - WHY storing the type in irqdata solves anything

    - WHAT sets the type in the actual interrupt hardware

That information should be in the changelog ....

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] irqdomain: handle the per-CPU irq trigger type settings
       [not found] <7d436524-73d4-5379-a409-d170e3ca70fe@huawei.com>
@ 2017-03-11  5:00 ` gengdongjiu
  0 siblings, 0 replies; 3+ messages in thread
From: gengdongjiu @ 2017-03-11  5:00 UTC (permalink / raw
  To: tglx; +Cc: jason, benh, linux-kernel, zhanghaibin7, huangshaoyu

Hi Gleixner,
  Thank you very much for your comment and review, I will update it later.

> 
> 
> 
> On Fri, 10 Mar 2017, gengdongjiu wrote:
> 
>>     when devices parse and map an per-cpu interrupt into linux virq space
>>     using irq_of_parse_and_map API, it will always be failed if needs to set
>>     the specified irq trigger type, because irq_set_irq_type is only for 1-N
>>     mode interrupt source, not for per-cpu interrupt source. so handle per-cpu
>>     IRQs for this failure.
> 
> Please format your changelogs proper into sections:
> 
> 1) Context
> 
> 2) Problem
> 
> 3) Solution
> 
> Writing one big lump of a sentence is just unreadable.
> 
> Aside of that:
> 
> 1) No indentation of the changelog
> 2) Sentences start with upper case letters
> 3) Function references want () after the function name
> 
> Aside
> 
>>
>>     Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>>                    Zhanghai bin <zhanghaibin7@huawei.com>
> 
> That SOB is bogus.
> 
>> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
>> index 9fd618d..8116cf2 100755
>> --- a/kernel/irq/irqdomain.c
>> +++ b/kernel/irq/irqdomain.c
>> @@ -542,8 +542,16 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
>>
>>         /* Set type if specified and different than the current one */
>>         if (type != IRQ_TYPE_NONE &&
>> -           type != irq_get_trigger_type(virq))
>> -               irq_set_irq_type(virq, type);
>> +           type != irq_get_trigger_type(virq)) {
>> +               int ret = 0;
>> +               struct irq_data *irq_data = irq_get_irq_data(virq);
>> +
>> +               ret = irq_set_irq_type(virq, type);
>> +
>> +                /* Handle per-cpu IRQ: just save type in irq_data */
>> +               if (-EINVAL == ret && irq_data)
>> +                       irqd_set_trigger_type(irq_data, type);
> 
> This is completely broken. That stores a trigger type for any interrupt if
> the set type function fails.
> 
> You fail to explain
> 
>     - WHY irq_set_irq_type() fails for these per cpu interrupts
> 
>     - WHY storing the type in irqdata solves anything
> 
>     - WHAT sets the type in the actual interrupt hardware
> 
> That information should be in the changelog ....
> 
> Thanks,
> 
>         tglx
> 
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-11  5:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-10  4:52 [PATCH] irqdomain: handle the per-CPU irq trigger type settings gengdongjiu
2017-03-10 10:35 ` Thomas Gleixner
     [not found] <7d436524-73d4-5379-a409-d170e3ca70fe@huawei.com>
2017-03-11  5:00 ` gengdongjiu

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.