All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-kernel@vger.kernel.org, Peter Tyser <ptyser@xes-inc.com>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH] x86, lpc, Allow only one load of lpc_ich
Date: Wed, 3 Sep 2014 08:43:15 +0100	[thread overview]
Message-ID: <20140903074315.GB28985@lee--X1> (raw)
In-Reply-To: <1409695097-5831-1-git-send-email-prarit@redhat.com>

[PATCH] x86, lpc, Allow only one load of lpc_ich

Please use $SUBJECT format corresponding to the subsystem.

This is not an X86 patch, it's an MFD one.

I would expecte to see something along the lines of:

  mfd: lpc_ich: Prevent LCP devices from probing twice

On Tue, 02 Sep 2014, Prarit Bhargava wrote:
> On multi-socket systems the following confusing splats are seen:
> 
>  ACPI: If an ACPI driver is available for this device, you should use it instead of the native driver
>  lpc_ich: Resource conflict(s) found affecting gpio_ich
>  ------------[ cut here ]------------
>  WARNING: CPU: 7 PID: 1813 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x64/0x80()
>  sysfs: cannot create duplicate filename '/bus/platform/devices/iTCO_wdt'

All this from here

------------------8<--------------------

>  Modules linked in: lpc_ich(+) crc32c_intel shpchp mfd_core acpi_cpufreq i2c_i801 dca xfs libcrc32c sd_mod crc_t10dif crct10dif_common ata_generic pata_acpi mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ttm mptsas drm scsi_transport_sas ata_piix mptscsih i2ccore libata mptbase dm_mirror dm_region_hash dm_log dm_mod
>  CPU: 7 PID: 1813 Comm: systemd-udevd Not tainted 3.17.0-rc3+ #1
>  Hardware name: IBM System x3950 M3 -[7145AC1]-/Node 1, Processor Card, BIOS -[G0E130WUS-1.31]- 07/23/2010
>   0000000000000000 00000000f205abcf ffff88066bb7b8d0 ffffffff81647056
>   ffff88066bb7b918 ffff88066bb7b908 ffffffff81072c9d ffff880273d05000
>   ffff88027349d110 ffff880874c5cc30 0000000000000001 ffffffffffffffef
>  Call Trace:
>   [<ffffffff81647056>] dump_stack+0x45/0x56
>   [<ffffffff81072c9d>] warn_slowpath_common+0x7d/0xa0
>   [<ffffffff81072d1c>] warn_slowpath_fmt+0x5c/0x80
>   [<ffffffff81256598>] ? kernfs_path+0x48/0x60
>   [<ffffffff81259e34>] sysfs_warn_dup+0x64/0x80
>   [<ffffffff8125a1b1>] sysfs_do_create_link_sd.isra.2+0xc1/0xd0
>   [<ffffffff8125a1e5>] sysfs_create_link+0x25/0x50
>   [<ffffffff81401689>] bus_add_device+0x119/0x200
>   [<ffffffff813ff4b8>] device_add+0x498/0x630
>   [<ffffffff810778f6>] ? __insert_resource+0x26/0x150
>   [<ffffffff81404391>] platform_device_add+0xd1/0x2d0
>   [<ffffffffa050b3f5>] mfd_add_device+0x285/0x320 [mfd_core]
>   [<ffffffffa050b705>] mfd_add_devices+0xb5/0x9b0 [mfd_core]
>   [<ffffffffa0abf55b>] lpc_ich_probe+0x3cb/0x600 [lpc_ich]
>   [<ffffffff8132eb55>] local_pci_probe+0x45/0xa0
>   [<ffffffff8132fd45>] ? pci_match_device+0xe5/0x110
>   [<ffffffff8132fea9>] pci_device_probe+0xf9/0x150
>   [<ffffffff814024b0>] driver_probe_device+0x90/0x3c0
>   [<ffffffff814028b3>] __driver_attach+0x93/0xa0
>   [<ffffffff81402820>] ? __device_attach+0x40/0x40
>   [<ffffffff814003f3>] bus_for_each_dev+0x73/0xc0
>   [<ffffffff81401f4e>] driver_attach+0x1e/0x20
>   [<ffffffff81401b30>] bus_add_driver+0x180/0x250
>   [<ffffffffa0acb000>] ? 0xffffffffa0acb000
>   [<ffffffff81403094>] driver_register+0x64/0xf0
>   [<ffffffff8132e4ec>] __pci_register_driver+0x4c/0x50
>   [<ffffffffa0acb01e>] lpc_ich_driver_init+0x1e/0x1000 [lpc_ich]
>   [<ffffffff81002144>] do_one_initcall+0xd4/0x210
>   [<ffffffff811c2fed>] ? kfree+0xfd/0x140
>   [<ffffffff811a8b42>] ? __vunmap+0xb2/0x100
>   [<ffffffff810f2839>] load_module+0x1619/0x1a70
>   [<ffffffff810edde0>] ? store_uevent+0x70/0x70
>   [<ffffffff810eea39>] ? copy_module_from_fd.isra.44+0x129/0x180
>   [<ffffffff810f2e46>] SyS_finit_module+0xa6/0xd0
>   [<ffffffff8164f069>] system_call_fastpath+0x16/0x1b
>  ---[ end trace 1429eb73c1995841 ]---
>  ------------[ cut here ]------------

------------------8<--------------------

To here.

>  WARNING: CPU: 71 PID: 1813 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x64/0x80()
>  sysfs: cannot create duplicate filename '/bus/platform/devices/gpio_ich'

And from here:

------------------8<--------------------

>  Modules linked in: serio_raw lpc_ich(+) crc32c_intel shpchp mfd_core acpi_cpufreq i2c_i801 dca xfs libcrc32c sd_mod crc_t10dif crct10dif_common ata_generic pata_acpi mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ttm mptsas drm scsi_transport_sas ata_piix mptscsih i2ccore libata mptbase dm_mirror dm_region_hash dm_log dm_mod
>  CPU: 71 PID: 1813 Comm: systemd-udevd Tainted: G        W      3.17.0-rc3+ #1
>  Hardware name: IBM System x3950 M3 -[7145AC1]-/Node 1, Processor Card, BIOS -[G0E130WUS-1.31]- 07/23/2010
>   0000000000000000 00000000f205abcf ffff88066bb7b8d0 ffffffff81647056
>   ffff88066bb7b918 ffff88066bb7b908 ffffffff81072c9d ffff88027382d000
>   ffff880273640030 ffff880874c5cc30 0000000000000001 ffffffffffffffef
>  Call Trace:
>   [<ffffffff81647056>] dump_stack+0x45/0x56
>   [<ffffffff81072c9d>] warn_slowpath_common+0x7d/0xa0
>   [<ffffffff81072d1c>] warn_slowpath_fmt+0x5c/0x80
>   [<ffffffff81256598>] ? kernfs_path+0x48/0x60
>   [<ffffffff81259e34>] sysfs_warn_dup+0x64/0x80
>   [<ffffffff8125a1b1>] sysfs_do_create_link_sd.isra.2+0xc1/0xd0
>   [<ffffffff8125a1e5>] sysfs_create_link+0x25/0x50
>   [<ffffffff81401689>] bus_add_device+0x119/0x200
>   [<ffffffff813ff4b8>] device_add+0x498/0x630
>   [<ffffffff810778f6>] ? __insert_resource+0x26/0x150
>   [<ffffffff81404391>] platform_device_add+0xd1/0x2d0
>   [<ffffffffa050b3f5>] mfd_add_device+0x285/0x320 [mfd_core]
>   [<ffffffffa050b705>] mfd_add_devices+0xb5/0x9b0 [mfd_core]
>   [<ffffffffa0abf464>] lpc_ich_probe+0x2d4/0x600 [lpc_ich]
>   [<ffffffff8132eb55>] local_pci_probe+0x45/0xa0
>   [<ffffffff8132fd45>] ? pci_match_device+0xe5/0x110
>   [<ffffffff8132fea9>] pci_device_probe+0xf9/0x150
>   [<ffffffff814024b0>] driver_probe_device+0x90/0x3c0
>   [<ffffffff814028b3>] __driver_attach+0x93/0xa0
>   [<ffffffff81402820>] ? __device_attach+0x40/0x40
>   [<ffffffff814003f3>] bus_for_each_dev+0x73/0xc0
>   [<ffffffff81401f4e>] driver_attach+0x1e/0x20
>   [<ffffffff81401b30>] bus_add_driver+0x180/0x250
>   [<ffffffffa0acb000>] ? 0xffffffffa0acb000
>   [<ffffffff81403094>] driver_register+0x64/0xf0
>   [<ffffffff8132e4ec>] __pci_register_driver+0x4c/0x50
>   [<ffffffffa0acb01e>] lpc_ich_driver_init+0x1e/0x1000 [lpc_ich]
>   [<ffffffff81002144>] do_one_initcall+0xd4/0x210
>   [<ffffffff811c2fed>] ? kfree+0xfd/0x140
>   [<ffffffff811a8b42>] ? __vunmap+0xb2/0x100
>   [<ffffffff810f2839>] load_module+0x1619/0x1a70
>   [<ffffffff810edde0>] ? store_uevent+0x70/0x70
>   [<ffffffff810eea39>] ? copy_module_from_fd.isra.44+0x129/0x180
>   [<ffffffff810f2e46>] SyS_finit_module+0xa6/0xd0
>   [<ffffffff8164f069>] system_call_fastpath+0x16/0x1b
>  ---[ end trace 1429eb73c1995842 ]---
>  lpc_ich 0000:80:1f.0: No MFD cells added

------------------8<--------------------

To here - should be removed from the commit log.

> This occurs because there are two LPC devices on the system:
> 
> 00:1f.0 ISA bridge: Intel Corporation 82801JIB (ICH10) LPC Interface Controller
> 80:1f.0 ISA bridge: Intel Corporation 82801JIB (ICH10) LPC Interface Controller
> 
> which AFAICT is a hardware configuration error that can be resolved in
> firmware by hiding the second LPC device.  Having two of these results in
> two GPIO mappings and two Watchdog Timers which doesn't make much sense.
> 
> An end user has no idea what the splats mean.  We should inform the user that
> the issue lies with the hardware and that they should contact their vendor
> for resolution.

Why is it a problem for 2 of these devices to exist on a single system?

Shouldn't the driver just be able to handle 2 devices?

> After the patch, the following warning is displayed:
> 
>  lpc_ich 0000:80:1f.0: [Firmware Bug]: This system has two LPC devices.  Additional driver loads would result in multiple GPIO and Watchdog Devices being initialized.  Please report this problem to your hardware vendor.

Your commit log goes way over 72 chars here.

> Cc: Peter Tyser <ptyser@xes-inc.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> ---
>  drivers/mfd/lpc_ich.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c
> index 7d8482f..eba66bc 100644
> --- a/drivers/mfd/lpc_ich.c
> +++ b/drivers/mfd/lpc_ich.c
> @@ -998,12 +998,17 @@ wdt_done:
>  	return ret;
>  }
>  
> +static bool cell_added;

Why have you globalised this?

>  static int lpc_ich_probe(struct pci_dev *dev,
>  				const struct pci_device_id *id)
>  {
>  	struct lpc_ich_priv *priv;
>  	int ret;
> -	bool cell_added = false;
> +
> +	if (cell_added) {
> +		dev_warn(&dev->dev, FW_BUG "This system has two LPC devices.  Additional driver loads would result in multiple GPIO and Watchdog Devices being initialized.  Please report this problem to your hardware vendor.\n");

Did you run this patch through checkpatch.pl?

> +		return -EBUSY;

You print a warning, but return an error here.  One of them is wrong.

But why is it a problem for two of these devices to exist anyway?

> +	}
>  
>  	priv = devm_kzalloc(&dev->dev,
>  			    sizeof(struct lpc_ich_priv), GFP_KERNEL);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2014-09-03  7:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 21:58 [PATCH] x86, lpc, Allow only one load of lpc_ich Prarit Bhargava
2014-09-03  7:43 ` Lee Jones [this message]
2014-09-03 10:13   ` Prarit Bhargava
2014-09-03 11:35     ` Lee Jones
2014-09-03 11:55       ` Prarit Bhargava
2014-09-03 12:19         ` Lee Jones
2014-09-03 12:23           ` Prarit Bhargava
2014-09-03 12:36             ` Lee Jones
2014-09-03 15:57             ` Guenter Roeck
2014-09-03 17:29               ` Peter Tyser
2014-09-03 17:56                 ` Prarit Bhargava
2014-09-03 19:13                   ` Peter Tyser
2014-09-03 20:08                     ` Guenter Roeck
2014-09-03 19:22                   ` Guenter Roeck

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=20140903074315.GB28985@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=ptyser@xes-inc.com \
    --cc=sameo@linux.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 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.