lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM6PR11MB34493E49EE53F58A96DF4BAC84519@DM6PR11MB3449.namprd11.prod.outlook.com>
Date:   Thu, 13 May 2021 12:19:26 +0000
From:   "Siwik, Grzegorz" <grzegorz.siwik@...el.com>
To:     Nick Lowe <nick.lowe@...il.com>,
        "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
CC:     "kuba@...nel.org" <kuba@...nel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "sassmann@...hat.com" <sassmann@...hat.com>,
        "Switzer, David" <david.switzer@...el.com>
Subject: RE: [PATCH net-next 2/6] igb: Add double-check MTA_REGISTER for i210
 and i211

Hi all,

> > > Looks like a potential infinite loop on persistent failure.
> > > Also you don't need "is_failed", you can use while (i >= 0), or 
> > > assign i = hw->mac.mta_reg_count, or consider using a goto.
> >
> > We will make a follow on patch to address these issues.
> >
> > Thanks,
> > Tony

> The patch for this that has been queued is as follows:

+     int failed_cnt = 3;
+     bool is_failed;
+     int i;
+
+     do {
+          is_failed = false;
+          for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) {
+               if (array_rd32(E1000_MTA, i) != hw->mac.mta_shadow[i]) {
+                    is_failed = true;
+                    array_wr32(E1000_MTA, i, hw->mac.mta_shadow[i]);
+                    wrfl();
+               }
+          }
+          if (is_failed && --failed_cnt <= 0) {
+               hw_dbg("Failed to update MTA_REGISTER, too many retries");
+               break;
+          }
+     } while (is_failed);

> https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue.git/commit/?h=dev-queue&id=9db33b54fb98525e323d0d3f16b01778f17b9493

> This will not reset the counter when checking each register and it will not debug output which register failed, this does not seem optimal.

> Could it make more sense to instead do something like this? (Untested)

I cannot agree for this part. In your solution we are checking every register 3 times. 
Entire MTA_ARRAY you will check MTA_REG_COUNT*3 times.
In my code this is worst case scenario - in best scenario I'm checking every MTA only one time.
Please remember that performance is also really important
Also the problem is that i21x devices could not always accept MTA_REGISTER setting. My code has been tested and verified as working.
In my opinion we don't have to know which E1000_MTA register has failed, but we should know that there is problem with entire MTA_REGISTER.
When I was checking this with test script for over 11M iterations this issue never happened more than one time in row. 

> +     int i;
> +     int attempt;
> +     for (i = hw->mac.mta_reg_count - 1; i >= 0; i--) {
> +          for (attempt = 3; attempt >= 1; attempt--) {
> +               if (array_rd32(E1000_MTA, i) != hw->mac.mta_shadow[i]) {
> +                    array_wr32(E1000_MTA, i, hw->mac.mta_shadow[i]);
> +                    wrfl();
> +
> +                    if (attempt == 1 && array_rd32(E1000_MTA, i) !=
> hw->mac.mta_shadow[i]) {
> +                         hw_dbg("Failed to update MTA_REGISTER %d,
> too many retries\n", i);
> +                    }
> +               }
> +          }
> +     }

> Best,

> Nick

Best Regards,
Grzegorz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ