On Thu, Feb 17, 2011 at 04:22:54PM +0100, Mike Belopuhov wrote:
> On Thu, Feb 10, 2011 at 14:25 +0100, Lukasz Czarniecki wrote:
> > Hi
> > 
> > I've bought a Dell R310 with H200 raid controller reported in dmesg as:
> > Symbios Logic SAS2008. It uses mpii driver and has two hard drives
> > configured in RAID 1.
> > 
> > Now it seems to work fine but i still have a problem with its
> > performance. Raid is fully initialized.
> > 
> > How can I help to resolve this problem?
> > 
> > I'm doing simple benchmark:
> > wget ftp.spline.de/pub/OpenBSD/4.8/sys.tar.gz
> > time tar xzf ./sys.tar.gz
> > 
> > On the same hardware Linux unpacks it in less then two seconds.
> > 
> > Numbers for OpenBSD:
> > 4.8 amd64 sp: 3m40.95s real 0m0.65s user 0m0.71s system
> > 4.8 amd64 mp-stable: 3m43.36s real 0m0.48s user 0m0.98s system
> > 4.9 amd64 sp: 3m47.72s real 0m0.51s user 0m0.69s system
> > 4.9 i386 rd : 3m45.11s real 0m1.03s user 0m1.19s system
> > 
> 
> Lukasz and me have figured out that disk write cache gets turned
> off by the Dell firmware when you create a volume (it doesn't get
> disabled if you use single drives):
> 
> http://support.dell.com/support/edocs/storage/storlink/h200/en/ug/html/features.htm#wp1062398
> 
> H200 doesn't have and there's no possibility to install an onboard
> memory and the battery, so the device becomes pretty much useless
> unless the operating system takes care of it.  Apparently Linux
> does.  Should OpenBSD do the same?  In my opinion yes.

Linux does this and we should too.  All SATA manufacturers recommend
(read recommend very very strongly and call you names when you don't
listen) enabling write cache.

> 
> Lukasz has tested the patch below and it works fine for him.  I don't
> have the hardware myself, so I'm not going to push it for the release,
> but if someone thinks it's worth it, please speak up.

I am ok with this making release and think it should.  I did not realize
WB was being disabled.

> 
> 
> Index: mpii.c
> ===================================================================
> RCS file: /home/cvs/src/sys/dev/pci/mpii.c,v
> retrieving revision 1.37
> diff -u -p -r1.37 mpii.c
> --- mpii.c    29 Dec 2010 03:55:09 -0000      1.37
> +++ mpii.c    17 Feb 2011 15:15:25 -0000
> @@ -981,6 +981,52 @@ struct mpii_msg_sas_oper_reply {
>       u_int32_t               ioc_loginfo;
>  } __packed;
>  
> +struct mpii_msg_raid_action_request {
> +     u_int8_t        action;
> +#define MPII_RAID_ACTION_CHANGE_VOL_WRITE_CACHE      (0x17)
> +     u_int8_t        reserved1;
> +     u_int8_t        chain_offset;
> +     u_int8_t        function;
> +
> +     u_int16_t       vol_dev_handle;
> +     u_int8_t        phys_disk_num;
> +     u_int8_t        msg_flags;
> +
> +     u_int8_t        vp_id;
> +     u_int8_t        vf_if;
> +     u_int16_t       reserved2;
> +
> +     u_int32_t       reserved3;
> +
> +     u_int32_t       action_data;
> +#define MPII_RAID_VOL_WRITE_CACHE_DISABLE    (0x01)
> +#define MPII_RAID_VOL_WRITE_CACHE_ENABLE     (0x02)
> +
> +     struct mpii_sge action_sge;
> +} __packed;
> +
> +struct mpii_msg_raid_action_reply {
> +     u_int8_t        action;
> +     u_int8_t        reserved1;
> +     u_int8_t        chain_offset;
> +     u_int8_t        function;
> +
> +     u_int16_t       vol_dev_handle;
> +     u_int8_t        phys_disk_num;
> +     u_int8_t        msg_flags;
> +
> +     u_int8_t        vp_id;
> +     u_int8_t        vf_if;
> +     u_int16_t       reserved2;
> +
> +     u_int16_t       reserved3;
> +     u_int16_t       ioc_status;
> +
> +     u_int32_t       action_data[5];
> +
> +     struct mpii_sge action_sge;
> +} __packed;
> +
>  struct mpii_cfg_hdr {
>       u_int8_t                page_version;
>       u_int8_t                page_length;
> @@ -1972,6 +2018,8 @@ int             mpii_req_cfg_page(struct mpii_softc
>  
>  int          mpii_get_ioc_pg8(struct mpii_softc *);
>  
> +void         mpii_cache_enable(struct mpii_softc *);
> +
>  #if NBIO > 0
>  int          mpii_ioctl(struct device *, u_long, caddr_t);
>  int          mpii_ioctl_inq(struct mpii_softc *, struct bioc_inq *);
> @@ -2175,6 +2223,9 @@ mpii_attach(struct device *parent, struc
>               goto free_dev;
>       }
>  
> +     /* enable write cache */
> +     mpii_cache_enable(sc);
> +
>       /* we should be good to go now, attach scsibus */
>       sc->sc_link.adapter = &mpii_switch;
>       sc->sc_link.adapter_softc = sc;
> @@ -3206,6 +3257,45 @@ mpii_cfg_coalescing(struct mpii_softc *s
>       }
>  
>       return (0);
> +}
> +
> +void
> +mpii_cache_enable(struct mpii_softc *sc)
> +{
> +     struct mpii_msg_raid_action_request     *req;
> +     struct mpii_device                      *dev;
> +     struct mpii_ccb                         *ccb;
> +     int                                     i;
> +
> +     ccb = scsi_io_get(&sc->sc_iopool, 0);
> +     if (ccb == NULL)
> +             return;
> +
> +     for (i = 0; i < sc->sc_max_devices; i++) {
> +             if (sc->sc_devs[i] == NULL ||
> +                 !ISSET(sc->sc_devs[i]->flags, MPII_DF_VOLUME))
> +                     continue;
> +
> +             dev = sc->sc_devs[i];
> +
> +             ccb->ccb_state = MPII_CCB_READY;
> +             ccb->ccb_rcb = NULL;
> +             ccb->ccb_done = mpii_empty_done;
> +
> +             req = ccb->ccb_cmd;
> +             bzero(req, sizeof(*req));
> +             req->function = MPII_FUNCTION_RAID_ACTION;
> +             req->action = MPII_RAID_ACTION_CHANGE_VOL_WRITE_CACHE;
> +             req->vol_dev_handle = htole16(dev->dev_handle);
> +             req->action_data = htole32(MPII_RAID_VOL_WRITE_CACHE_ENABLE);
> +
> +             if (mpii_poll(sc, ccb) != 0)
> +                     return;
> +
> +             if (ccb->ccb_rcb != NULL)
> +                     mpii_push_reply(sc, ccb->ccb_rcb);
> +     }
> +     scsi_io_put(&sc->sc_iopool, ccb);
>  }
>  
>  #define MPII_EVENT_MASKALL(enq)              do {                    \

Reply via email to