From nobody Sat Feb 12 11:40:07 2022 X-Original-To: virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6C66E1955160 for ; Sat, 12 Feb 2022 11:40:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JwpSR0dyyz3hTc for ; Sat, 12 Feb 2022 11:40:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E532E26F71 for ; Sat, 12 Feb 2022 11:40:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 21CBe67O094723 for ; Sat, 12 Feb 2022 11:40:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 21CBe65W094722 for virtualization@FreeBSD.org; Sat, 12 Feb 2022 11:40:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: virtualization@FreeBSD.org Subject: [Bug 260200] AHCI emulation throws CAM errors when backed by -t malloc memory disk devices Date: Sat, 12 Feb 2022 11:40:07 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bhyve X-Bugzilla-Version: 13.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: afedorov@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: virtualization@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-virtualization@freebsd.org X-BeenThere: freebsd-virtualization@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644666007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OxlWFuIusMvaPDbQkHQ0yyljiFzlk2r2ejgTyYgtco0=; b=ncRNKM0tWmNXqjSp+rBpb1MolFErjeemySVmfeL7WxtAmv6ShqpJkQVXDFtXWRKQdu/q5i cxU3dErjxWh/l5UnNPf239qux6ntC/7EIxjbTQpZr9s0BBheVi60Eq3VwJ30r2loM3/9CF scOFvp+dd33i7YexScuTH1DaEUUJ4lonGWoTq/oEbszaphvF2urI/gF7xvCCWceKk0WtWU 0o2ueyx6zO1P8CWpCbtp2f9IN2IP3Ge0UsgS3IUaqUNkwFVrZAAANJJgirGFqB22pUBQ2M nRQEuXczVCUzLCt1aA2vFffc78Fy/znxM0xqqCsySxfMwTn48fgMMYxaYSGDHw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644666007; a=rsa-sha256; cv=none; b=Bd20s1IF7Rrwa+Hz/iTfMfwS61utl37IxPAHjVMFjLBofxxsUU4mfV828iFcEU2UBlLBSS mhaRm0Eo+CFeDDrN4eigg6PPgn2doGS3waeCvnuX1BOyOS4xsbmBVOwBs6IuAzSUtaOSZZ eYbAENjYAYzaPpcQ8LtqHyBtgoT1oN0sLzXTIYMItu0UxaJNpVqRWObs8Dl84XTHSXRs3b 3UIr2svWo+Y4XKc5QqbLKWGrl+eweu6deYXnNCx14g326X/Pi1hbQH65iYkVcbeuvHcD0e kptaIZ7oS0Cx6nqmqyQfBXDFiy2L7Y1MOp9AHuE6R1nBQ0PZHjTvf5HO21Vw+w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260200 Aleksandr Fedorov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |afedorov@FreeBSD.org, | |markj@FreeBSD.org --- Comment #2 from Aleksandr Fedorov --- This is because md(4) + memory backend doesn't support the DIOCGFLUSH ioctl (BIO_FLUSH command): https://github.com/freebsd/freebsd-src/blob/main/sys/dev/md/md.c#L650 pci_ahci.c: https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/bhyve/pci_ahci.c#= L783 So I see two ways to solve this issue. First, fix bhyve with patch like this: diff --git a/usr.sbin/bhyve/block_if.c b/usr.sbin/bhyve/block_if.c index 98c0f9f5f38b..3fb81bb86ae2 100644 --- a/usr.sbin/bhyve/block_if.c +++ b/usr.sbin/bhyve/block_if.c @@ -102,6 +102,7 @@ struct blockif_ctxt { int bc_ischr; int bc_isgeom; int bc_candelete; + int bc_canflush; int bc_rdonly; off_t bc_size; int bc_sectsz; @@ -224,6 +225,8 @@ static int blockif_flush_bc(struct blockif_ctxt *bc) { if (bc->bc_ischr) { + if (bc->bc_canflush =3D=3D 0) + return (0); if (ioctl(bc->bc_fd, DIOCGFLUSH)) return (errno); } else if (fsync(bc->bc_fd)) @@ -463,7 +466,7 @@ blockif_open(nvlist_t *nvl, const char *ident) struct diocgattr_arg arg; off_t size, psectsz, psectoff; int extra, fd, i, sectsz; - int ro, candelete, geom, ssopt, pssopt; + int ro, candelete, canflush, geom, ssopt, pssopt; int nodelete; #ifndef WITHOUT_CAPSICUM @@ -566,6 +569,12 @@ blockif_open(nvlist_t *nvl, const char *ident) candelete =3D arg.value.i; if (ioctl(fd, DIOCGPROVIDERNAME, name) =3D=3D 0) geom =3D 1; + if (ioctl(fd, DIOCGFLUSH) =3D=3D 0) + canflush =3D 1; + else if (errno =3D=3D ENOTSUP) { + canflush =3D 0; + errno =3D 0; + } } else psectsz =3D sbuf.st_blksize; @@ -614,6 +623,7 @@ blockif_open(nvlist_t *nvl, const char *ident) bc->bc_ischr =3D S_ISCHR(sbuf.st_mode); bc->bc_isgeom =3D geom; bc->bc_candelete =3D candelete; + bc->bc_canflush =3D canflush; bc->bc_rdonly =3D ro; bc->bc_size =3D size; bc->bc_sectsz =3D sectsz; Second, add a NOP support of the BIO_FLUSH cmd to md(4) (mdstart_malloc()). --=20 You are receiving this mail because: You are the assignee for the bug.=