public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Khalid Aziz <khalid_aziz@hp.com>
Cc: fastboot@lists.osdl.org, linux-ia64@vger.kernel.org,
	linux-kernel@vger.kernel.org, tony.luck@intel.com
Subject: Re: [PATCH] kexec for ia64
Date: Tue, 14 Mar 2006 06:44:04 +0000	[thread overview]
Message-ID: <20060313224404.1133fc28.akpm@osdl.org> (raw)
In-Reply-To: <1142271576.10787.15.camel@lyra.fc.hp.com>

Khalid Aziz <khalid_aziz@hp.com> wrote:
>
> I have updated kexec patch for ia64. Attached patch fixes a couple of
> bugs from previous version and incorporates code developed by Nan Hai.
> This patch works on 2.6.16-rc6 kernel. Also attached is a patch for
> kexec-tools which applies on top of kexec-tools-1.101 release from Eric
> Biederman <http://www.xmission.com/%
> 7Eebiederm/files/kexec/kexec-tools-1.101.tar.gz> and adds support for
> ia64. Please test and provide feedback.
> 
> I am working on integrating kdump support and will post that patch once
> I have tested it.
> 

> diff -urNp linux-2.6.16-rc2/arch/ia64/kernel/crash.c linux-2.6.16-rc2-ia64kexec/arch/ia64/kernel/crash.c
> --- linux-2.6.16-rc2/arch/ia64/kernel/crash.c	1969-12-31 17:00:00.000000000 -0700
> +++ linux-2.6.16-rc2-ia64kexec/arch/ia64/kernel/crash.c	2006-02-09 15:36:23.000000000 -0700
> ...
> +extern void device_shutdown(void);
> ...

extern declarations always go in headers, please.  This patch adds zillions
of them in .c files.  It is risky and duplicative.

> diff -urNp linux-2.6.16-rc2/arch/ia64/kernel/machine_kexec.c linux-2.6.16-rc2-ia64kexec/arch/ia64/kernel/machine_kexec.c
> --- linux-2.6.16-rc2/arch/ia64/kernel/machine_kexec.c	1969-12-31 17:00:00.000000000 -0700
> +++ linux-2.6.16-rc2-ia64kexec/arch/ia64/kernel/machine_kexec.c	2006-03-10 14:36:51.000000000 -0700
> ...
> +#include <linux/kernel.h>
> +#include <linux/config.h>
> +#include <linux/mm.h>
> +#include <linux/kexec.h>
> +#include <linux/pci.h>
> +#ifdef CONFIG_HOTPLUG_CPU
> +#include <linux/cpu.h>
> +#endif

The ifdef shouldn't be needed.

> +
> +DECLARE_PER_CPU(u64, ia64_mca_pal_base);
> +
> +extern unsigned long ia64_iobase;
> +extern unsigned long kexec_reboot;
> +extern void kexec_stop_this_cpu(void *);
> +extern struct subsystem devices_subsys;

In header files.

> +const extern unsigned char relocate_new_kernel[];
> +const extern unsigned long kexec_fake_sal_rendez[];
> +const extern unsigned int relocate_new_kernel_size;

Even things which are defined via vmlinux.lds magic should be declared in
headers.

> +extern void ioc_iova_disable(void);

In a header.

> +volatile extern long kexec_rendez;
> +volatile const extern unsigned char kexec_rendez_reloc[];

Ditto.

> +
> +void machine_shutdown(void)
> +{
> +	struct pci_dev *dev;
> +	irq_desc_t *idesc;
> +	cpumask_t mask = CPU_MASK_NONE;
> +
> +	/* Disable all PCI devices */
> +	list_for_each_entry(dev, &pci_devices, global_list) {
> +		if (!(dev->is_enabled)) {
> +			continue;
> +		}

Unneeded braces.

> +		if (!(idesc = irq_descp(dev->irq)))

This:

		idesc = irq_descp(dev->irq);
		if (!idesc)

is preferred.

> +#ifdef CONFIG_SMP
> +#ifdef CONFIG_HOTPLUG_CPU

#if defined(CONFIG_SMP) && defined(CONFIG_HOTPLUG_CPU)

is tidier.   But CONFIG_HOTPLUG_CPU already depends on CONFIG_SMP.


> +	int cpu;
> +
> +	for_each_online_cpu(cpu) {
> +		if (cpu != smp_processor_id())
> +			cpu_down(cpu);
> +	}
> +#else
> +	smp_call_function(kexec_stop_this_cpu, (void *)image->start, 0, 0);
> +#endif
> +#endif

Why is different code needed for hotplug cpu?

> +	ia64_set_itv(1<<16);
> +	/* Interrupts aren't acceptable while we reboot */
> +	local_irq_disable();
> +
> +	/* set kr0 to the appropriate address */
> +	set_io_base();
> +
> +	{
> +		unsigned long pta, impl_va_bits;
> +
> +#       define pte_bits                 3
> +#       define vmlpt_bits               (impl_va_bits - PAGE_SHIFT + pte_bits)

Why not simply open-code these things?

> +#       define POW2(n)                  (1ULL << (n))

And that.

> +		/* Disable VHPT */
> +		impl_va_bits = ffz(~(local_cpu_data->unimpl_va_mask | (7UL << 61)));
> +		pta = POW2(61) - POW2(vmlpt_bits);
> +		ia64_set_pta(pta | (0 << 8) | (vmlpt_bits << 2) | 0);
> +	}
> +
> +#ifdef CONFIG_IA64_HP_ZX1
> +	ioc_iova_disable();
> +#endif

> ...

> --- linux-2.6.16-rc2/arch/ia64/kernel/smp.c	2006-01-02 20:21:10.000000000 -0700
> +++ linux-2.6.16-rc2-ia64kexec/arch/ia64/kernel/smp.c	2006-02-15 16:37:33.000000000 -0700
> @@ -30,6 +30,9 @@
>  #include <linux/delay.h>
>  #include <linux/efi.h>
>  #include <linux/bitops.h>
> +#ifdef CONFIG_KEXEC
> +#include <linux/kexec.h>
> +#endif

The ifdefs shouldn't be needed.

>  #include <asm/atomic.h>
>  #include <asm/current.h>
> @@ -84,6 +87,43 @@ unlock_ipi_calllock(void)
>  	spin_unlock_irq(&call_lock);
>  }
>  
> +#ifdef CONFIG_KEXEC
> +extern void kexec_fake_sal_rendez(void *start, unsigned long wake_up,
> +		unsigned long pal_base);

That should go in a header file.

> +#define pte_bits	3
> +#define vmlpt_bits	(impl_va_bits - PAGE_SHIFT + pte_bits)
> +#define POW2(n)		(1ULL << (n))

Duplicative.

> +DECLARE_PER_CPU(u64, ia64_mca_pal_base);

In a header file.

>  /*
> + * Terminate any outstanding interrupts
> + */
> +void terminate_irqs(void)
> +{
> +	struct irqaction * action;
> +	irq_desc_t *idesc;
> +	int i;
> +
> +	for (i=0; i<NR_IRQS; i++) {
> +		idesc = irq_descp(i);
> +		action = idesc->action;
> +		if (!action)
> +			continue;
> +		if (idesc->handler->end)
> +			idesc->handler->end(i);
> +	}
> +}

Perhaps that should be in kernel/irq/something.c?

  reply	other threads:[~2006-03-14  6:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-13 17:39 [PATCH] kexec for ia64 Khalid Aziz
2006-03-14  6:44 ` Andrew Morton [this message]
2006-03-14 16:00   ` Khalid Aziz
2006-03-14  6:48 ` Zou Nan hai
2006-03-14 16:08   ` Khalid Aziz
2006-03-15  0:07     ` Zou Nan hai

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=20060313224404.1133fc28.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=fastboot@lists.osdl.org \
    --cc=khalid_aziz@hp.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.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