From owner-svn-src-stable@freebsd.org Fri Dec 14 22:16:43 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 4471913223E1; Fri, 14 Dec 2018 22:16:43 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) (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 8AFEA6DEAD; Fri, 14 Dec 2018 22:16:42 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by mail-lf1-x142.google.com with SMTP id n18so5384980lfh.6; Fri, 14 Dec 2018 14:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=nWtdqrUune7X1Dwaw9oDY3eFvYCc+b0+VQigrMVun/E=; b=u9/+AXkTztW8eBxPtZsFq9pJUgs23ybXOp0ICnk5rhnnEnjcqTAVf2Q6ziLa+0NQhz 5dNuLDy0zL42PSt4YWBQcejSte3uhTK0XuXtUexbjs1Yzr8XHX+ZF4VB5ME8HTigxLPq fcQJC4dripadlk//WovgcXCQ+p0UrcJ8jDgfq8q/iQBBLpETNz3VmQmkFOzMg6qrofCl Bx9hJoSAwseahWNg2S5uojbpl1nh0eXi8vGkoWAsW+ell9Lb+Igsg4XtrjNsATxKq1Qo xAR+JDtK1Bm6B1hEpAccBJKCqLZ4g/JZUv7QrGQDSZKbv/k6jn8uhPcWRMg733fzl0cV Y/NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=nWtdqrUune7X1Dwaw9oDY3eFvYCc+b0+VQigrMVun/E=; b=hQ7Pf2TOy2GBdE7EW942WxOqAk5FWnuO4ZEuvd1X6f2HCHol8Jo8SJYLM6PCK2wfC4 1RGlQVLt4rcMI00mcnoxoe+Q17+OhA8NsXL4y5U1wfhkxcdlNyP+/xAp4NOSEBgNMM3W +ub1EcbF5lEWYz1jRsoypEaqYdUiG+bQeYqWWU84FdGBb/o81bICmDyFHG0HQxJ+TWz8 Imq+RLHvieT5tnXmQk6AFy4z5QvK/mZUFTF+0wazg1xhwm4tjD+QdHKP15Ncek61/ep8 F6AoUq13COSSLzD7JgJgzul5/m/t8MGAZkel36u08BFiyR5bXHiT8JprTii8zAHCg+xR 3M0A== X-Gm-Message-State: AA+aEWZKEvvjp3DbIdhP4UKxpyF6TPjcPzM3CkBJaY7FgGrDQEsCzdPl vQtrpVVWndRaTnZXI9h1KwM+uJLKib7WHhKiFVFzFQ== X-Google-Smtp-Source: AFSGD/UW3zlgjPxcV5eFmMfvjE7i47/a1scghjXdPBT0tsVr2lgZE35+6H3kM/Yv2Y1lpxfs3YAX44MsMUqf4HMWDSk= X-Received: by 2002:a19:1d0d:: with SMTP id d13mr2680249lfd.74.1544825800766; Fri, 14 Dec 2018 14:16:40 -0800 (PST) MIME-Version: 1.0 References: <201812141449.wBEEn5eQ001337@repo.freebsd.org> In-Reply-To: <201812141449.wBEEn5eQ001337@repo.freebsd.org> Reply-To: araujo@freebsd.org From: Marcelo Araujo Date: Sat, 15 Dec 2018 06:16:28 +0800 Message-ID: Subject: Re: svn commit: r342083 - stable/12/usr.sbin/bhyve To: Alexander Motin Cc: src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org X-Rspamd-Queue-Id: 8AFEA6DEAD X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.996,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.99)[-0.988,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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:16:43 -0000 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 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); > >