Re: [Openipmi-developer] [PATCH] ipmi: Cleanup oops on initialization failure

2018-06-21 Thread Meelis Roos
> > The corresponding dmesg:
> > 
> > [7.372830] IPMI System Interface driver.
> > [7.373034] ipmi_si dmi-ipmi-si.0: ipmi_platform: probing via SMBIOS
> > [7.373109] ipmi_si: SMBIOS: mem 0x0 regsize 1 spacing 1 irq 0
> > [7.373182] ipmi_si: Adding SMBIOS-specified kcs state machine
> > [7.373352] ipmi_si: Trying SMBIOS-specified kcs state machine at mem
> > address 0x0, slave address 0x20, irq 0
> > [7.373479] ipmi_si dmi-ipmi-si.0: Could not set up I/O space
> > 
> > > BTW, can you send me at least the IPMI portion of the output of
> > > dmidecode for your machine?  I have seen a lot of these where the
> > > address in the SMBIOS tables is incorrect, and I'm wondering if
> > > it's something in the driver, or if it's really the tables that
> > > are bad.
> > Handle 0x001B, DMI type 38, 18 bytes
> > IPMI Device Information
> >  Interface Type: KCS (Keyboard Control Style)
> >  Specification Version: 2.0
> >  I2C Slave Address: 0x10
> >  NV Storage Device: Not Present
> >  Base Address: 0x (Memory-mapped)
> >  Register Spacing: Successive Byte Boundaries
> 
> Thanks a bunch.  It looks like the SMBIOS tables are wrong.  I
> wonder if this is what some vendor do if there is no IPMI device
> installed.  I guess I need to add a check for this.

Another machine (Sun X2100) with similar crash is also cured by the 
patch, but this is slightly different (not NULL):

[8.891217] IPMI System Interface driver.
[8.898404] ipmi_si dmi-ipmi-si.0: ipmi_platform: probing via SMBIOS
[8.905635] ipmi_si: SMBIOS: io 0xca2 regsize 1 spacing 1 irq 0
[8.912895] ipmi_si: Adding SMBIOS-specified kcs state machine
[8.920246] ipmi_si: Trying SMBIOS-specified kcs state machine at i/o 
address 0xca2, slave address 0x20, irq 0
[8.934379] ipmi_si dmi-ipmi-si.0: Interface detection failed

IPMI Device Information
Interface Type: KCS (Keyboard Control Style)
Specification Version: 1.5
I2C Slave Address: 0x10
NV Storage Device: Not Present
Base Address: 0x0CA2 (I/O)
Register Spacing: Successive Byte Boundaries



-- 
Meelis Roos (mr...@linux.ee)

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


Re: [Openipmi-developer] [PATCH] ipmi: Cleanup oops on initialization failure

2018-06-20 Thread Meelis Roos
> Commit 93c303d2045b3 "ipmi_si: Clean up shutdown a bit" didn't
> copy the behavior of the cleanup in one spot, it needed to
> check for a non-NULL interface before cleaning it up.
> 
> Signed-off-by: Corey Minyard 

Tested-by: Meelis Roos 


The corresponding dmesg:

[7.372830] IPMI System Interface driver.
[7.373034] ipmi_si dmi-ipmi-si.0: ipmi_platform: probing via SMBIOS
[7.373109] ipmi_si: SMBIOS: mem 0x0 regsize 1 spacing 1 irq 0
[7.373182] ipmi_si: Adding SMBIOS-specified kcs state machine
[7.373352] ipmi_si: Trying SMBIOS-specified kcs state machine at mem 
address 0x0, slave address 0x20, irq 0
[7.373479] ipmi_si dmi-ipmi-si.0: Could not set up I/O space

> BTW, can you send me at least the IPMI portion of the output of
> dmidecode for your machine?  I have seen a lot of these where the
> address in the SMBIOS tables is incorrect, and I'm wondering if
> it's something in the driver, or if it's really the tables that
> are bad.

Handle 0x001B, DMI type 38, 18 bytes
IPMI Device Information
Interface Type: KCS (Keyboard Control Style)
Specification Version: 2.0
I2C Slave Address: 0x10
NV Storage Device: Not Present
Base Address: 0x (Memory-mapped)
Register Spacing: Successive Byte Boundaries

> 
> Thanks for reporting this.  On your tested-by I'll send this up
> to Linus.
> 
> -corey
> 
>  drivers/char/ipmi/ipmi_si_intf.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_si_intf.c 
> b/drivers/char/ipmi/ipmi_si_intf.c
> index 3d0add6..a5987f8 100644
> --- a/drivers/char/ipmi/ipmi_si_intf.c
> +++ b/drivers/char/ipmi/ipmi_si_intf.c
> @@ -2088,8 +2088,10 @@ static int try_smi_init(struct smi_info *new_smi)
>   return 0;
>  
>  out_err:
> - ipmi_unregister_smi(new_smi->intf);
> - new_smi->intf = NULL;
> + if (new_smi->intf) {
> + ipmi_unregister_smi(new_smi->intf);
> + new_smi->intf = NULL;
> + }
>  
>   kfree(init_name);
>  
> 

-- 
Meelis Roos (mr...@linux.ee)

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


[Openipmi-developer] iomi-si UBSAN warning and NULL pointer dereference

2018-06-19 Thread Meelis Roos
0006 R12: c0181aa8
[7.611822] R13:  R14: 8e8e3b2df240 R15: c0181260
[7.611894] FS:  7fef3a80b8c0() GS:8e8e3dd0() 
knlGS:
[7.611988] CS:  0010 DS:  ES:  CR0: 80050033
[7.612067] CR2:  CR3: 3ab1a000 CR4: 000006e0


-- 
Meelis Roos (mr...@linux.ee)

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer


[Openipmi-developer] [PATCH] fix NULL device in ipmi_si error message

2018-06-06 Thread Meelis Roos
I noticed that 4.17.0 logs the follwing during ipmi_si setup:

 ipmi_si :01:04.6: probing via PCI
 (NULL device *): Could not setup I/O space
 ipmi_si :01:04.6: [mem 0xf5ef-0xf5ef00ff] regsize 1 spacing 1 irq 21

Fix the "NULL device *) by moving io.dev assignment before its potential 
use by ipmi_pci_probe_regspacing().

Result:
 ipmi_si :01:04.6: probing via PCI
 ipmi_si :01:04.6: Could not setup I/O space
 ipmi_si :01:04.6: [mem 0xf5ef-0xf5ef00ff] regsize 1 spacing 1 irq 21

Signed-off-by: Meelis Roos 

diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c
index f54ca6869ed2..022e03634ce2 100644
--- a/drivers/char/ipmi/ipmi_si_pci.c
+++ b/drivers/char/ipmi/ipmi_si_pci.c
@@ -120,6 +120,8 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
}
io.addr_data = pci_resource_start(pdev, 0);
 
+   io.dev = >dev;
+
io.regspacing = ipmi_pci_probe_regspacing();
io.regsize = DEFAULT_REGSIZE;
io.regshift = 0;
@@ -128,8 +130,6 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
if (io.irq)
io.irq_setup = ipmi_std_irq_setup;
 
-   io.dev = >dev;
-
dev_info(>dev, "%pR regsize %d spacing %d irq %d\n",
>resource[0], io.regsize, io.regspacing, io.irq);
 

-- 
Meelis Roos (mr...@linux.ee)

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Openipmi-developer mailing list
Openipmi-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer