9601 Divide by zero in i40e_get_available_resources()

Review Request #1116 — Created June 19, 2018 and submitted

marcel
illumos-gate
master
9601
be5c6dc...
general
This fixes the num_ports calculation in the i40e driver.  Without this fix we
sometimes (at least with the hardware where I tested this on) found more
ethernet ports than we actually have (four instead of two) and this lead to
panic later in the driver.
I tested this on a hardware where the original driver paniced.  With the fix
the driver does not panic and it works properly.
  • 0
  • 0
  • 0
  • 1
  • 1
Description From Last Updated
rm
  1. I think this seems reasonable, but we should add a README to the main i40e directory noting our differences to the Intel common code ala uts/common/io/e1000api/README.illumos otherwise we're likely to have someone accidentally clobber this in an update. I'll see if I can follow up with Intel to update this fact.

  2. 
      
kmays
  1. Ship It!
  2. 
      
cherimoya
  1. Ship It!
  2. 
      
kmays
  1. Ship It!
  2. 
      
marcel
jlevon
  1. FYI we tested this change on a system with this issue and can confirm this solved the problem. Looking forward to seeing it in the gate!

    1. Can you provide specific detail on this hardware, including pciid, and if an onboard part, the MoBo provider?
    2. https://www.supermicro.com/en/products/motherboard/X11SPM-TF

      from prtconf -dD it's
      pci15d9,37d2 (pciex8086,37d2) - X722

  2. 
      
rm
  1. 
      
  2. So, when I did this I didn't grab Intel's drivers from Intel, but from the FreeBSD tree directly. I'm not sure the 1.6.10 reference is accurate.
    
    Reading the bit here, it comes across as the diff below the bug IDs is the changes, where as that's not actually the case.
    
    I'm not sure if it's worth mentioning that most of the original diffs you have below were in service of Studio and the 32-bit kernel. It's almost certainly the case that we can probably drop most of them with an update (the ones inlined that is).
    1. So, when I did this I didn't grab Intel's drivers from Intel, but from the FreeBSD tree directly. I'm not sure the 1.6.10 reference is accurate.

      It was really funny to find the best matching upstream our code was derived from.

      We do have 16 source files in the usr/src/uts/common/io/i40e/core/ directory (i40e_adminq.c, i40e_adminq_cmd.h, i40e_adminq.h, i40e_alloc.h, i40e_common.c, i40e_devids.h, i40e_hmc.c, i40e_hmc.h, i40e_lan_hmc.c, i40e_lan_hmc.h, i40e_nvm.c, i40e_prototype.h, i40e_register.h, i40e_status.h, i40e_type.h, i40e_virtchnl.h). There are 4 commits in the illumos-gate (9d26e4f, 396505a, 3d75a28, 286d309) for this directory. This is our set of downstream versions.

      For the upstream we do have 117 commits in the sys/dev/ixl directory of the FreeBSD repo (https://github.com/freebsd/freebsd). I also have downloaded 18 versions of the ixl driver from Intel (1.4.0, 1.4.5, 1.4.8, 1.4.27, 1.6.8, 1.6.10, 1.7.11, 1.7.12, 1.7.12.1, 1.7.39, 1.8.1, 1.9.5, 1.9.7, 1.9.8, 1.9.12, 1.9.13, 1.10.4, 1.11.9). This is set of 135 possible upstream versions.

      Then I did simple diff -urN between all 4 downstream versions and all 135 upstream versions (this is 4 x 135 = 540 diffs) and I found this:

      1.1) The first illumos changeset (9d26e4f) is closest to 17 FreeBSD changesets in range d19d4db (2015-06-05) - 123efcd (2016-04-09); the diffs are about 12kB.
      1.2) The first illumos changeset (9d26e4f) is closest to version 1.6.8 of the ixl driver; the diff is about 162kB.

      2.1) The second illumos changeset (396505a) is closest to 17 FreeBSD changesets in range d19d4db (2015-06-05) - 123efcd (2016-04-09); the diffs are about 17kB.
      2.2) The second illumos changeset (396505a) is closest to version 1.6.8 of the ixl driver; the diff is about 158kB.

      3.1) The third illumos changeset (3d75a28) is closest to 3 FreeBSD changesets in range 1edbd9d (2017-02-10) - 922a5bb (2017-07-13); the diffs are about 22kB.
      3.2) The third illumos changeset (3d75a28) is closest to version 1.6.10 of the ixl driver; the diff is about 3kB.

      3.1) The fourth illumos changeset (286d309) is closest to 3 FreeBSD changesets in range 1edbd9d (2017-02-10) - 922a5bb (2017-07-13); the diffs are about 25kB.
      3.2) The fourth illumos changeset (286d309) is closest to version 1.6.10 of the ixl driver; the diff is about 7kB.

      So the clear winner and closest match is illumos changeset 3d75a28 vs. ixl-1.6.10.

    2. Reading the bit here, it comes across as the diff below the bug IDs is the changes, where as that's not actually the case.

      I'd be happy to improve it so it is more obvious, but I'm not sure how exactly (what I did is clear to me, but I'm biased obviously). Any suggestion?

      I'm not sure if it's worth mentioning that most of the original diffs you have below were in service of Studio and the 32-bit kernel. It's almost certainly the case that we can probably drop most of them with an update (the ones inlined that is).

      I think it is not worth to mention the reason for this initial diff in the README.illumos. And yes, we could probably safely drop that. Even before the update (simple wsdiff build should be enough to confirm that nothing changes; maybe I'll do that as a follow up once this one integrates).

    3. Regarding the source version. Fair enough. It may both be the closest version, but also not what I used (since the version published by Intel and the version in the FreeBSD tree is sometimes different). I mostly mentioned it just for accuracy's sake. It wasn't generated from those, though I accept that by cirucmstance those are the closest ones. I wanted to make sure the record was straight regarding what I had done.

      Regarding the content, whe I first read it it seemed like those two bugs listed were responsible for the diffe that followed. I might suggest something like:

      This directory contains files extracted from the Intel ixl-1.6.10 driver for
      FreeBSD with the following modifications/differences. The following two changes
      each modified the common code.
      
      9805 i40e should read SFP data when firmware supports it
      9601 Divide by zero in i40e_get_available_resources()
      
      The following diff was originally applied to add support for Studio and the 32-bit kernel:
      
      <original diff>
      

      Basically I want to make it clear that the diff and the other bugs are separate and that each bug has its own changes.

    4. Okay. Will do. Thanks.

      Now I see that I probably had to swap lines with 9805 and 9601, so they are in the reverse chronological order (newest-first/oldest-last).

  3. 
      
marcel
rm
  1. Ship It!
  2. 
      
marcel
Review request changed

Status: Closed (submitted)

Change Summary:

commit f0c1c263e90642997cf3e76484abec617782ddb8
Author:     Marcel Telka <marcel@telka.sk>
AuthorDate: Mon Nov 11 21:33:22 2019 +0100
Commit:     Dan McDonald <danmcd@joyent.com>
CommitDate: Thu Nov 14 11:19:43 2019 -0500

    9601 Divide by zero in i40e_get_available_resources()
    Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

:100644 100644 7fc4834fa2 4123d2a183 M	exception_lists/copyright
:100644 100644 0adee1a9e3 6564081f83 M	exception_lists/wscheck
:000000 100644 0000000000 47cb1fdf2d A	usr/src/uts/common/io/i40e/core/README.illumos
:100644 100644 f4dd8da819 0e0dc285ae M	usr/src/uts/common/io/i40e/core/i40e_common.c
Loading...