Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/dev/pci Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/2861f438819e
branches:  netbsd-8
changeset: 319739:2861f438819e
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jun 09 14:32:52 2018 +0000

description:
Pull up following revision(s) (requested by maya in ticket #857):

        sys/dev/pci/mpii.c: revision 1.9

PR/52330: Jia-Ju Bai: mpii driver: a sleep-in-interrupt bug in mpii_intr
Since the enclosing routime mpii_event_raid already calls malloc with
M_NOWAIT, fix the cache routine to do the same. While there check the
result of the cache routine and change some error prints to aprint.

diffstat:

 sys/dev/pci/mpii.c |  40 +++++++++++++++++++++++++---------------
 1 files changed, 25 insertions(+), 15 deletions(-)

diffs (109 lines):

diff -r 2e3e55fb6452 -r 2861f438819e sys/dev/pci/mpii.c
--- a/sys/dev/pci/mpii.c        Fri Jun 08 10:25:23 2018 +0000
+++ b/sys/dev/pci/mpii.c        Sat Jun 09 14:32:52 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8 2016/05/02 19:18:29 christos Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.1 2018/06/09 14:32:52 martin Exp $ */
 /*     OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp    */
 /*
  * Copyright (c) 2010 Mike Belopuhov <mkb%crypt.org.ru@localhost>
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8 2016/05/02 19:18:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.1 2018/06/09 14:32:52 martin Exp $");
 
 #include "bio.h"
 
@@ -3434,26 +3434,34 @@
                        case MPII_EVT_IR_CFG_ELEMENT_RC_VOLUME_CREATED:
                                if (mpii_find_dev(sc,
                                    le16toh(ce->vol_dev_handle))) {
-                                       printf("%s: device %#x is already "
-                                           "configured\n", DEVNAME(sc),
+                                       aprint_error_dev(sc->sc_dev,
+                                           "device %#x is already "
+                                           "configured\n",
                                            le16toh(ce->vol_dev_handle));
                                        break;
                                }
                                dev = malloc(sizeof(*dev), M_DEVBUF,
                                    M_NOWAIT | M_ZERO);
                                if (!dev) {
-                                       printf("%s: failed to allocate a "
-                                           "device structure\n", DEVNAME(sc));
+                                       aprint_error_dev(sc->sc_dev,
+                                           "can't allocate device structure\n");
                                        break;
                                }
                                SET(dev->flags, MPII_DF_VOLUME);
                                dev->slot = sc->sc_vd_id_low;
                                dev->dev_handle = le16toh(ce->vol_dev_handle);
                                if (mpii_insert_dev(sc, dev)) {
+                                       aprint_error_dev(sc->sc_dev,
+                                           "can't insert device structure\n");
                                        free(dev, M_DEVBUF);
                                        break;
                                }
-                               mpii_cache_enable(sc, dev);
+                               if (mpii_cache_enable(sc, dev)) {
+                                       aprint_error_dev(sc->sc_dev,
+                                           "can't enable device cache\n");
+                                       free(dev, M_DEVBUF);
+                                       break;
+                               }
                                sc->sc_vd_count++;
                                break;
                        case MPII_EVT_IR_CFG_ELEMENT_RC_REMOVED:
@@ -3515,15 +3523,15 @@
                switch (pe->phy_status & MPII_EVENT_SAS_TOPO_PS_RC_MASK) {
                case MPII_EVENT_SAS_TOPO_PS_RC_ADDED:
                        if (mpii_find_dev(sc, le16toh(pe->dev_handle))) {
-                               printf("%s: device %#x is already "
-                                   "configured\n", DEVNAME(sc),
+                               aprint_error_dev(sc->sc_dev,
+                                   "device %#x is already configured\n",
                                    le16toh(pe->dev_handle));
                                break;
                        }
                        dev = malloc(sizeof(*dev), M_DEVBUF, M_NOWAIT | M_ZERO);
                        if (!dev) {
-                               printf("%s: failed to allocate a "
-                                   "device structure\n", DEVNAME(sc));
+                               aprint_error_dev(sc->sc_dev, "can't allocate "
+                                   "device structure\n");
                                break;
                        }
                        dev->slot = sc->sc_pd_id_start + tcl->start_phy_num + i;
@@ -3534,6 +3542,8 @@
                        dev->enclosure = le16toh(tcl->enclosure_handle);
                        dev->expander = le16toh(tcl->expander_handle);
                        if (mpii_insert_dev(sc, dev)) {
+                               aprint_error_dev(sc->sc_dev, "can't insert "
+                                   "device structure\n");
                                free(dev, M_DEVBUF);
                                break;
                        }
@@ -3550,9 +3560,9 @@
                                    DVACT_DEACTIVATE);
                                if (scsi_task(mpii_event_defer, sc,
                                    dev, 0) != 0)
-                                       printf("%s: unable to run device "
-                                           "detachment routine\n",
-                                           DEVNAME(sc));
+                                       aprint_error_dev(sc->sc_dev, 
+                                           "unable to run device "
+                                           "detachment routine\n");
                        }
 #else
                        mpii_event_defer(sc, dev);
@@ -4979,7 +4989,7 @@
                return (EINVAL);
 
        pagelen = hdr.page_length * 4;
-       vpg = malloc(pagelen, M_TEMP, M_WAITOK | M_CANFAIL | M_ZERO);
+       vpg = malloc(pagelen, M_TEMP, M_NOWAIT | M_ZERO);
        if (vpg == NULL)
                return (ENOMEM);
 



Home | Main Index | Thread Index | Old Index