All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vijay Kilari <vijay.kilari@gmail.com>
To: Julien Grall <julien.grall@linaro.org>
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Prasun Kapoor <Prasun.Kapoor@caviumnetworks.com>,
	Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>,
	xen-devel@lists.xen.org,
	Stefano Stabellini <stefano.stabellini@citrix.com>
Subject: Re: [RFC PATCH v1 01/10] xen/arm: make secondary gic init as notifier call
Date: Sat, 22 Mar 2014 13:46:52 +0530	[thread overview]
Message-ID: <CALicx6spfuZw7fXfkVFRjrbh2ikwxr85hJ6HgdrvZ=mcTGG2aQ@mail.gmail.com> (raw)
In-Reply-To: <532AE392.1080107@linaro.org>

On Thu, Mar 20, 2014 at 6:18 PM, Julien Grall <julien.grall@linaro.org> wrote:
> Hello Vijay,
>
> Thanks for your patch.
>
> On 03/19/2014 02:17 PM, vijay.kilari@gmail.com wrote:
>> From: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>>
>> make gic init for secondary cpus as notifier call
>> instead calling directly from secondary boot for
>> each cpu. This makes secondary gic init generic and runtime.
>>
>> Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
>> ---
>>  xen/arch/arm/gic.c        |   35 ++++++++++++++++++++++++++---------
>>  xen/arch/arm/smpboot.c    |    3 +--
>>  xen/include/asm-arm/gic.h |    2 --
>>  3 files changed, 27 insertions(+), 13 deletions(-)
>>
>> diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
>> index 91a2982..4be0897 100644
>> --- a/xen/arch/arm/gic.c
>> +++ b/xen/arch/arm/gic.c
>> @@ -20,6 +20,7 @@
>>  #include <xen/config.h>
>>  #include <xen/lib.h>
>>  #include <xen/init.h>
>> +#include <xen/cpu.h>
>>  #include <xen/mm.h>
>>  #include <xen/irq.h>
>>  #include <xen/sched.h>
>> @@ -380,6 +381,30 @@ static void __cpuinit gic_hyp_disable(void)
>>      GICH[GICH_HCR] = 0;
>>  }
>>
>> +/* Set up the per-CPU parts of the GIC for a secondary CPU */
>> +static int  __cpuinit gic_init_secondary_cpu(struct notifier_block *nfb,
>> +                                        unsigned long action, void *hcpu)
>> +{
>> +    if (action == CPU_STARTING)
>> +    {
>> +        spin_lock(&gic.lock);
>> +        gic_cpu_init();
>> +        gic_hyp_init();
>> +        spin_unlock(&gic.lock);
>> +    }
>> +    return NOTIFY_DONE;
>> +}
>> +
>
> This is not the correct way to create a notifier block.
>
> You should have a good similar to (see an example in common/timer.c):
>
> static cpu_callback(struct notifier_block* nfb,
>                     unsigned long action, void *hcpu)
> {
>      unsigned int cpu = (unsigned long)hcpu;
>
>      switch ( action )
>      case CPU_STARTING:
>         gic_init_secondary_cpu();
>         break;
>      default:
>         break;
>      return NOTIFY_DONE;
> }

Apart from __cpuinit, I could not see any difference with this implementation.
am I missing anything specific?

>
>> +static struct notifier_block gic_cpu_nb = {
>> +    .notifier_call = gic_init_secondary_cpu,
>> +    .priority = 100
>> +};
>
>> +static void gic_smp_init(void)
>> +{
>> +   register_cpu_notifier(&gic_cpu_nb);
>> +}
>> +
>
> You don't need to create a separate function to register the notifier.
> You can directly call it in gic_init.
>
OK
>>  int gic_irq_xlate(const u32 *intspec, unsigned int intsize,
>>                    unsigned int *out_hwirq,
>>                    unsigned int *out_type)
>> @@ -469,6 +494,7 @@ void __init gic_init(void)
>>      spin_lock_init(&gic.lock);
>>      spin_lock(&gic.lock);
>>
>> +    gic_smp_init();
>>      gic_dist_init();
>>      gic_cpu_init();
>>      gic_hyp_init();
>> @@ -524,15 +550,6 @@ void smp_send_state_dump(unsigned int cpu)
>>      send_SGI_one(cpu, GIC_SGI_DUMP_STATE);
>>  }
>>
>> -/* Set up the per-CPU parts of the GIC for a secondary CPU */
>> -void __cpuinit gic_init_secondary_cpu(void)
>> -{
>> -    spin_lock(&gic.lock);
>> -    gic_cpu_init();
>> -    gic_hyp_init();
>> -    spin_unlock(&gic.lock);
>> -}
>> -
>>  /* Shut down the per-CPU GIC interface */
>>  void gic_disable_cpu(void)
>>  {
>> diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
>> index a829957..765efcf 100644
>> --- a/xen/arch/arm/smpboot.c
>> +++ b/xen/arch/arm/smpboot.c
>> @@ -283,7 +283,7 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
>>
>>      mmu_init_secondary_cpu();
>>
>> -    gic_init_secondary_cpu();
>> +    notify_cpu_starting(cpuid);
>
> Can you explain why it's safe to move notify_cpu_starting earlier?
>
   When gic registers a notifier with action as CPU_STARTING, I am
getting a panic
   from gic driver because notify_cpu_starting() is called after most of the GIC
   initialization calls as below from start_secondary() are called.
Especially the issue is coming
   with init_maintenanc_interrupt(). So I have moved this notifier
before other GIC initialization
   calls and since I move notifier only before GIC initialization
calls it not be a problem.

    init_secondary_IRQ();

    gic_route_ppis();

    init_maintenance_interrupt();
    init_timer_interrupt();

    In linux also similar problem (not same) with GICv3 is observered
    http://marc.info/?l=git-commits-head&m=138418939813393&w=2

>>
>>      init_secondary_IRQ();
>>
>> @@ -297,7 +297,6 @@ void __cpuinit start_secondary(unsigned long boot_phys_offset,
>>      setup_cpu_sibling_map(cpuid);
>>
>>      /* Run local notifiers */
>
> Please move also the comment, it's part of notify_cpu_starting. It
> doesn't make any sense alone here.
>
OK
>> -    notify_cpu_starting(cpuid);
>>      wmb();
>
> Regards,
>
> --
> Julien Grall

  reply	other threads:[~2014-03-22  8:16 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 14:17 [RFC PATCH v1 00/10] xen/arm: Add GICv3 support vijay.kilari
2014-03-19 14:17 ` [RFC PATCH v1 01/10] xen/arm: make secondary gic init as notifier call vijay.kilari
2014-03-20 12:48   ` Julien Grall
2014-03-22  8:16     ` Vijay Kilari [this message]
2014-03-23 14:38       ` Julien Grall
2014-03-26 11:27         ` Vijay Kilari
2014-03-26 14:41           ` Julien Grall
2014-03-26 17:22             ` George Dunlap
2014-03-21 17:15   ` Ian Campbell
2014-03-22  8:32     ` Vijay Kilari
2014-03-22 13:54       ` Julien Grall
2014-03-24 10:53         ` Ian Campbell
2014-03-19 14:17 ` [RFC PATCH v1 02/10] xen/arm: register mmio handler at runtime vijay.kilari
2014-03-20 13:18   ` Julien Grall
2014-03-21 13:19     ` Andrii Tseglytskyi
2014-03-21 17:17   ` Ian Campbell
2014-03-21 17:23     ` Julien Grall
2014-03-26 12:29       ` Vijay Kilari
2014-03-26 14:47         ` Julien Grall
2014-03-27  5:40           ` Vijay Kilari
2014-03-27 15:02             ` Julien Grall
2014-04-01  9:34               ` Vijay Kilari
2014-04-01 11:00                 ` Julien Grall
2014-04-01 12:32                   ` Vijay Kilari
2014-04-01 12:44                     ` Ian Campbell
2014-04-01 12:51                     ` Julien Grall
2014-04-01 13:05                       ` Vijay Kilari
2014-04-01 13:56                         ` Julien Grall
2014-03-19 14:17 ` [RFC PATCH v1 03/10] xen/arm: move vgic data to vgic driver vijay.kilari
2014-03-20 13:51   ` Julien Grall
2014-03-21 17:23     ` Ian Campbell
2014-03-22  9:20       ` Vijay Kilari
2014-03-24 10:57         ` Ian Campbell
2014-03-26 11:44           ` Vijay Kilari
2014-03-26 12:00             ` Ian Campbell
2014-03-26 12:42               ` Vijay Kilari
2014-03-22  9:17     ` Vijay Kilari
2014-03-20 17:14   ` Stefano Stabellini
2014-03-20 17:56     ` Julien Grall
2014-03-20 18:11       ` Stefano Stabellini
2014-03-21  9:22         ` Ian Campbell
2014-03-19 14:17 ` [RFC PATCH v1 04/10] arm/xen: move gic save and restore registers to gic driver vijay.kilari
2014-03-20 15:22   ` Julien Grall
2014-03-21 17:26     ` Ian Campbell
2014-03-22  9:22     ` Vijay Kilari
2014-03-20 17:23   ` Stefano Stabellini
2014-03-21 17:28     ` Ian Campbell
2014-03-22  9:27     ` Vijay Kilari
2014-03-19 14:17 ` [RFC PATCH v1 05/10] xen/arm: move gic definitions to seperate file vijay.kilari
2014-03-20 15:13   ` Julien Grall
2014-03-19 14:17 ` [RFC PATCH v1 06/10] xen/arm: split gic driver into generic and gicv2 driver vijay.kilari
2014-03-20 11:55   ` Stefano Stabellini
2014-03-22  9:32     ` Vijay Kilari
2014-03-23 14:43       ` Julien Grall
2014-03-24 11:01         ` Ian Campbell
2014-03-20 16:02   ` Julien Grall
2014-03-21 17:32     ` Ian Campbell
2014-03-21 17:37       ` Julien Grall
2014-03-22  9:40     ` Vijay Kilari
2014-03-23 15:05       ` Julien Grall
2014-03-20 16:39   ` Stefano Stabellini
2014-03-21 17:38   ` Ian Campbell
2014-03-22  9:59     ` Vijay Kilari
2014-03-24 11:06       ` Ian Campbell
2014-03-19 14:17 ` [RFC PATCH v1 07/10] xen/arm: split vgic into generic and GIC v2 specific drivers vijay.kilari
2014-03-19 14:17 ` [RFC PATCH v1 08/10] xen/arm: Add support for GIC v3 vijay.kilari
2014-03-20 12:37   ` Stefano Stabellini
2014-03-22 10:07     ` Vijay Kilari
2014-03-24 11:28       ` Ian Campbell
2014-03-24 17:01       ` Stefano Stabellini
2014-03-26 13:16         ` Vijay Kilari
2014-03-26 17:22           ` Stefano Stabellini
2014-03-20 16:40   ` Julien Grall
2014-03-22 10:21     ` Vijay Kilari
2014-03-23 14:49       ` Julien Grall
2014-03-24 11:26         ` Ian Campbell
2014-03-24 11:50           ` Julien Grall
2014-03-24 17:02       ` Stefano Stabellini
2014-03-19 14:17 ` [RFC PATCH v1 09/10] xen/arm: Add vgic " vijay.kilari
2014-03-20 12:38   ` Stefano Stabellini
2014-03-19 14:17 ` [RFC PATCH v1 10/10] xen/arm: GICv3 device tree parsing vijay.kilari
2014-03-20 16:08   ` Julien Grall
2014-03-22 10:30     ` Vijay Kilari
2014-03-24 11:43       ` Ian Campbell
2014-03-24 12:03         ` Julien Grall
2014-03-24 12:07           ` Ian Campbell
2014-03-24 12:08           ` Julien Grall
2014-03-24 17:34             ` Stefano Stabellini
2014-03-24 18:00               ` Julien Grall
2014-03-25 11:04                 ` Stefano Stabellini
2014-03-25 12:33                   ` Julien Grall
2014-03-25 12:34                     ` Julien Grall
2014-04-01 12:59                     ` Ian Campbell
2014-04-01 13:07                       ` Julien Grall
2014-03-20 11:55 ` [RFC PATCH v1 00/10] xen/arm: Add GICv3 support Stefano Stabellini

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='CALicx6spfuZw7fXfkVFRjrbh2ikwxr85hJ6HgdrvZ=mcTGG2aQ@mail.gmail.com' \
    --to=vijay.kilari@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Prasun.Kapoor@caviumnetworks.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=vijaya.kumar@caviumnetworks.com \
    --cc=xen-devel@lists.xen.org \
    /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.