From owner-svn-src-stable@freebsd.org Fri Dec 14 22:45:17 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 189E21322E3E; Fri, 14 Dec 2018 22:45:17 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb31.google.com (mail-yb1-xb31.google.com [IPv6:2607:f8b0:4864:20::b31]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91B706EF04; Fri, 14 Dec 2018 22:45:16 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb31.google.com with SMTP id d2so2905858ybs.11; Fri, 14 Dec 2018 14:45:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:openpgp:autocrypt:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=00HfDL3Y4sZ6CSuIjMBGKt5vWHOE/kKHgPSDIu+Cpmo=; b=rD6Znen2GyqWJ7Ec2l88TfZhMB4FtpvCruaZ9RfCZ75rrjkdOJa2tfrq3ZD/b29v8M UPTzGz6Zv2YYVqWn1HI2tOKcSWOZrZtw86FKo2HZteVwtBbom1Yl+RnsxHNxUjlt5XWY n5lp8Yjd1JgCXW9R/tVszkWIBpKslt6Wn+1+FZklIzXmGeVSgo1TY5lJahLMUfWVPzCr iFq721+ldzACNlyxoDjYWGAr10H/tKQXZ5l67GpiMoLQsg+Y29Yv1nkZZdkeOLwtMIAj ZrnjjMUyxzdHvAQoHShqYVDkWNQY4GuJEft1MiKyrGZfaSN4Ie/ib3Y0AyLxSJnqE1m8 Y7Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:openpgp :autocrypt:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=00HfDL3Y4sZ6CSuIjMBGKt5vWHOE/kKHgPSDIu+Cpmo=; b=A0wD79Wxb4d/ZYTSIPlwv+viVpvJ7AYmv4f4J8z+U1xXwsWYhrAtv5MCqwG5rgMPXy CxbYc1zgj35nNK//bT+bglvcMv4DiE7/8+y7DSKADAh/tL4Fx4OZmCXg994W8Huu3WMH X+fnpgzIsxciUoxrIcw97YxMMusOlExuSVHRlY9KsI38r8XabxR/hSK4SPgSOPINttAE vno3UrvlIiQ4yPiPUw7/g/ODK34LvZkfu16Fh6NF+mudTJgmP9gVznpq43LhKKFakTRP 6PUPbfukKYKK2iK/j19jUuVd+I/pTKCuoPFntnbfoKL9ecRtUUcjklAz8csNQBb9x3RO ZJxw== X-Gm-Message-State: AA+aEWYAca4PjANHtrysQiWZJ/LRcCeFiU289yq0WnIU6EhKqdILh+BN 7LeUku7DMdeO1UTGiuSF4LiNz0dJ X-Google-Smtp-Source: AFSGD/V4ph7OMPcH7P3T1WB0stEX9Cw/9dc7WT1wYnz5k2pfm/gJrWz3BPhUcKMYx5Wc4ltuyqvnVg== X-Received: by 2002:a5b:845:: with SMTP id v5mr5020993ybq.96.1544827515562; Fri, 14 Dec 2018 14:45:15 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id b129sm1883921ywc.106.2018.12.14.14.45.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 14:45:14 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r342083 - stable/12/usr.sbin/bhyve To: araujo@freebsd.org Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201812141449.wBEEn5eQ001337@repo.freebsd.org> From: Alexander Motin Open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-2a9780a51304@FreeBSD.org> Date: Fri, 14 Dec 2018 17:45:14 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 91B706EF04 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.994,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2018 22:45:17 -0000 Generally you are right. But I considered previous state of this code in stable/12 as worse then what can happen from this change. And I'll be around to help if anything is found. On 14.12.2018 17:16, Marcelo Araujo wrote: > Your mfc was quite fast less than 1 week, usually we take a bit more of > time before we do the mfc!  > > On Fri, Dec 14, 2018, 10:49 PM Alexander Motin wrote: > > Author: mav > Date: Fri Dec 14 14:49:04 2018 > New Revision: 342083 > URL: https://svnweb.freebsd.org/changeset/base/342083 > > Log: >   MFC r341829: Allow CTL device specification in bhyve virtio-scsi. > >   There was a large refactoring done in CTL to allow multiple ioctl > frontend >   ports (and respective devices) to be created, particularly for bhyve. >   Unfortunately, respective part of bhyve functionality got lost > somehow from >   the original virtio-scsi commit.  This change allows wanted device > path to >   be specified in either of two ways: >    -s 6,virtio-scsi,/dev/cam/ctl1.1 >    -s 6,virtio-scsi,dev=/dev/cam/ctl2.3 >   If neither is specified, the default /dev/cam/ctl device is used. > >   While there, remove per-queue CTL device opening, which makes no > sense at >   this point. > > Modified: >   stable/12/usr.sbin/bhyve/bhyve.8 >   stable/12/usr.sbin/bhyve/pci_virtio_scsi.c > Directory Properties: >   stable/12/   (props changed) > > Modified: stable/12/usr.sbin/bhyve/bhyve.8 > ============================================================================== > --- stable/12/usr.sbin/bhyve/bhyve.8    Fri Dec 14 14:46:35 2018    >     (r342082) > +++ stable/12/usr.sbin/bhyve/bhyve.8    Fri Dec 14 14:49:04 2018    >     (r342083) > @@ -24,7 +24,7 @@ >  .\" >  .\" $FreeBSD$ >  .\" > -.Dd October 24, 2018 > +.Dd December 11, 2018 >  .Dt BHYVE 8 >  .Os >  .Sh NAME > @@ -298,7 +298,16 @@ if not explicitly specified. >  .Pp >  SCSI devices: >  .Bl -tag -width 10n > -.It Pa /dev/cam/ Ns Oo , Ns Ar port and initiator_id Oc > +.It Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc Ns Oo , Ns Ar > scsi-device-options Oc > +.El > +.Pp > +The > +.Ar scsi-device-options > +are: > +.Bl -tag -width 10n > +.It Li iid= Ns Ar IID > +Initiator ID to use when sending requests to specified CTL port. > +The default value is 0. >  .El >  .Pp >  TTY devices: > > Modified: stable/12/usr.sbin/bhyve/pci_virtio_scsi.c > ============================================================================== > --- stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Fri Dec 14 14:46:35 > 2018        (r342082) > +++ stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Fri Dec 14 14:49:04 > 2018        (r342083) > @@ -105,7 +105,6 @@ struct pci_vtscsi_config { >  struct pci_vtscsi_queue { >         struct pci_vtscsi_softc *         vsq_sc; >         struct vqueue_info *              vsq_vq; > -       int                               vsq_ctl_fd; >         pthread_mutex_t                   vsq_mtx; >         pthread_mutex_t                   vsq_qmtx; >         pthread_cond_t                    vsq_cv; > @@ -529,7 +528,7 @@ pci_vtscsi_request_handle(struct > pci_vtscsi_queue *q, >                 sbuf_delete(sb); >         } > > -       err = ioctl(q->vsq_ctl_fd, CTL_IO, io); > +       err = ioctl(sc->vss_ctl_fd, CTL_IO, io); >         if (err != 0) { >                 WPRINTF(("CTL_IO: err=%d (%s)\n", errno, > strerror(errno))); >                 cmd_wr->response = VIRTIO_SCSI_S_FAILURE; > @@ -639,14 +638,8 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc, >         int i; > >         queue->vsq_sc = sc; > -       queue->vsq_ctl_fd = open("/dev/cam/ctl", O_RDWR); >         queue->vsq_vq = &sc->vss_vq[num + 2]; > > -       if (queue->vsq_ctl_fd < 0) { > -               WPRINTF(("cannot open /dev/cam/ctl: %s\n", > strerror(errno))); > -               return (-1); > -       } > - >         pthread_mutex_init(&queue->vsq_mtx, NULL); >         pthread_mutex_init(&queue->vsq_qmtx, NULL); >         pthread_cond_init(&queue->vsq_cv, NULL); > @@ -672,24 +665,34 @@ static int >  pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) >  { >         struct pci_vtscsi_softc *sc; > -       char *optname = NULL; > -       char *opt; > -       int i; > +       char *opt, *optname; > +       const char *devname; > +       int i, optidx = 0; > >         sc = calloc(1, sizeof(struct pci_vtscsi_softc)); > -       sc->vss_ctl_fd = open("/dev/cam/ctl", O_RDWR); > +       devname = "/dev/cam/ctl"; > +       while ((opt = strsep(&opts, ",")) != NULL) { > +               optname = strsep(&opt, "="); > +               if (opt == NULL && optidx == 0) { > +                       if (optname[0] != 0) > +                               devname = optname; > +               } else if (strcmp(optname, "dev") == 0 && opt != NULL) { > +                       devname = opt; > +               } else if (strcmp(optname, "iid") == 0 && opt != NULL) { > +                       sc->vss_iid = strtoul(opt, NULL, 10); > +               } else { > +                       fprintf(stderr, "Invalid option %s\n", optname); > +                       free(sc); > +                       return (1); > +               } > +               optidx++; > +       } > > +       sc->vss_ctl_fd = open(devname, O_RDWR); >         if (sc->vss_ctl_fd < 0) { > -               WPRINTF(("cannot open /dev/cam/ctl: %s\n", > strerror(errno))); > +               WPRINTF(("cannot open %s: %s\n", devname, > strerror(errno))); > +               free(sc); >                 return (1); > -       } > - > -       while ((opt = strsep(&opts, ",")) != NULL) { > -               if ((optname = strsep(&opt, "=")) != NULL) { > -                       if (strcmp(optname, "iid") == 0) { > -                               sc->vss_iid = strtoul(opt, NULL, 10); > -                       } > -               } >         } > >         vi_softc_linkup(&sc->vss_vs, &vtscsi_vi_consts, sc, pi, > sc->vss_vq); > -- Alexander Motin