mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Dongjiu Geng <gengdongjiu@huawei.com>
Cc: benh@kernel.crashing.org, jason@lakedaemon.net,
	linux-kernel@vger.kernel.org, zhanghaibin7@huawei.com,
	huangshaoyu@huawei.com
Subject: Re: [PATCH v2-kernel 4.1] irqdomain: handle the per-CPU irq trigger type settings
Date: Mon, 13 Mar 2017 09:58:50 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.20.1703130928400.3558@nanos> (raw)
In-Reply-To: <1489381226-8806-1-git-send-email-gengdongjiu@huawei.com>

On Mon, 13 Mar 2017, Dongjiu Geng wrote:

Subject: [PATCH v2-kernel 4.1] ....

Please do not submit patches against random ancient kernel
versions. Patches need to be written against current Linus tree or against
a current subsystem maintainer tree/branch.

> when percpu devices set its IRQ trigger type using irq_of_parse

Sentences still start with upper case letters.

> and_map API,it will be failed 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.
> 
> problem: per cpu device call irq_of_parse_and_map to set its
> timer trigger type IRQ_TYPE_EDGE_RISING, irq_of_parse_and_map
> will call irq_create_of_mapping to set trigger_type through
> irq_set_irq_type. But irq_set_irq_type uses
> IRQ_GET_DESC_CHECK_GLOBAL and not IRQ_GET_DESC_CHECK_PERCPU.
> per-cpu IRQ is per-cpu and not global.

So this it the actual problem that irq_set_irq_type() does not handle
irq_set_irq_type().

> solution: storing the type into irqdata, then get this IRQ
> type fromirq_get_trigger_type, and enable_percpu_irq sets the
> type

> --- 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)

Once more. This 'solution' is doing that write unconditionally for any
interrupt returning -EINVAL. So how is that handling per-cpu interrupts?

Side note: Kernel coding style is: ret == -EINVAL

> +			irqd_set_trigger_type(irq_data, type);
> +	}

Just for the record: Upstream has a proper solution for this problem
already.

Thanks,

	tglx

      reply	other threads:[~2017-03-13  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13  5:00 Dongjiu Geng
2017-03-13  8:58 ` Thomas Gleixner [this message]

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=alpine.DEB.2.20.1703130928400.3558@nanos \
    --to=tglx@linutronix.de \
    --cc=benh@kernel.crashing.org \
    --cc=gengdongjiu@huawei.com \
    --cc=huangshaoyu@huawei.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhanghaibin7@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®