eeh patch

Olof Johansson olof at austin.ibm.com
Wed Mar 17 06:58:04 EST 2004


Nathan Fontenot wrote:

> The (2.6) patch and user-space daemon code have been tested, so I am
> hoping to get some feedback before pushing this on to Ameslab.

See comments/questions below

> diff -Nru a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
> --- a/arch/ppc64/kernel/eeh.c	Mon Mar 15 09:41:21 2004
> +++ b/arch/ppc64/kernel/eeh.c	Mon Mar 15 09:41:21 2004
> @@ -50,6 +50,13 @@
>  static char *eeh_opts;
>  static int eeh_opts_last;
>
> +static spinlock_t slot_errbuf_lock = SPIN_LOCK_UNLOCKED;
> +static unsigned char slot_errbuf[RTAS_ERROR_LOG_MAX];
> +
> +DECLARE_WAIT_QUEUE_HEAD(eeh_hotplug_wait);
> +static unsigned char eeh_hotplug_buf[128]; /* should be long enough */

Maybe a define + using snprintf with the limit, just to play safe and be
a good kernel citizen? We've seen weird/overly large data from OF in
other areas lately.

> +		if (strcmp(dn->name, "ethernet") == 0) {
> +			dn->eeh_mode |= EEH_MODE_NOCHECK;
> +			sprintf(eeh_hotplug_buf, "%s", dn->full_name);

Why is ethernet treated separately here? Is it the only device type we
support hotplug of at the moment?

> +
> +static int proc_eeh_hotplug_show(struct seq_file *m, void *v)
> +{
> +	int rc;
> +
> +	rc = wait_event_interruptible(eeh_hotplug_wait, eeh_hotplug_event);
> +	if (rc)
> +		return 0;
> +
> +	seq_printf(m, "%s", eeh_hotplug_buf);
> +	memset(eeh_hotplug_buf, 0, 128);
> +	eeh_hotplug_event = 0;
> +
> +	return 0;
> +}
> +
> +static int proc_eeh_hotplug_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, proc_eeh_hotplug_show, NULL);
> +}

Besides Greg's opinions about the userspace daemon design, there's one
drawback with this: doing a simple cat of the proc file in question will
hang. It might not be a desired default behaviour, since it'll surprise
people. Especially since permissions are 444 on the file.


-Olof

--
Olof Johansson                                        Office: 4F005/905
Linux on Power Development                            IBM Systems Group
Email: olof at austin.ibm.com                          Phone: 512-838-9858
All opinions are my own and not those of IBM

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list