Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jul 2023 23:42:20 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Mike Karels <mike@karels.net>, FreeBSD ARM List <freebsd-arm@freebsd.org>, Current FreeBSD <freebsd-current@freebsd.org>
Subject:   Re: aarch64 lib32 vs. armv7 mdconfig behavior: "mdconfig: ioctl(/dev/mdctl): Inappropriate ioctl for device"
Message-ID:  <BD17072E-922F-48B0-BB0C-4447D07B0AA3@yahoo.com>
In-Reply-To: <49479F21-3CCD-469F-BF23-FF332D8EF0E8@yahoo.com>
References:  <49479F21-3CCD-469F-BF23-FF332D8EF0E8@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Jul 31, 2023, at 23:22, Mark Millard <marklmi@yahoo.com> wrote:

> Not via a chroot'd context, but using the files from a
> directory tree that allows an armv7 chroot:
>=20
> # /usr/obj/DESTDIRs/main-CA7-chroot/sbin/mdconfig -s40m
> mdconfig: ioctl(/dev/mdctl): Inappropriate ioctl for device
>=20
> This sort of thing messes up the operation of the likes
> of the /usr/tests/sbin/growfs/legacy_test logic:
>=20
> #! /usr/local/bin/perl
> # $FreeBSD$
>=20
> use strict;
> use warnings;
> use POSIX;
> use Test::More tests =3D> 19;
> use Fcntl qw(:DEFAULT :seek);
> . . .
> SKIP: {
>    skip "Cannot test without UID 0", 19 if $<;
>=20
>    chomp(my $md =3D `mdconfig -s40m`);
>    like($md, qr/^md\d+$/, "Created $md with size 40m") or die;
>    $unit =3D substr $md, 2;
> . . .
>=20
>=20
> Other ioctl complaints:
>=20
> sys/aio/aio_test:md_kq  ->  failed: ioctl MDIOCATTACH failed: =
Inappropriate ioctl for device
> sys/aio/aio_test:md_poll  ->  failed: ioctl MDIOCATTACH failed: =
Inappropriate ioctl for device
> sys/aio/aio_test:md_signal  ->  failed: ioctl MDIOCATTACH failed: =
Inappropriate ioctl for device
> sys/aio/aio_test:md_suspend  ->  failed: ioctl MDIOCATTACH failed: =
Inappropriate ioctl for device
> sys/aio/aio_test:md_thread  ->  failed: ioctl MDIOCATTACH failed: =
Inappropriate ioctl for device
> sys/aio/aio_test:md_waitcomplete  ->  failed: ioctl MDIOCATTACH =
failed: Inappropriate ioctl for device
> sys/aio/aio_test:vectored_md_poll  ->  failed: ioctl MDIOCATTACH =
failed: Inappropriate ioctl for device
>=20
>=20
> For reference:
>=20
> # uname -apKU
> FreeBSD CA78C-WDK23-ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT aarch64 =
1400093 #5 main-n264334-215bab7924f6-dirty: Wed Jul 26 02:13:44 PDT 2023 =
    =
root@CA78C-WDK23-ZFS:/usr/obj/BUILDs/main-CA78C-nodbg-clang/usr/main-src/a=
rm64.aarch64/sys/GENERIC-NODBG-CA78C arm64 aarch64 1400093 1400093


Adding more examples of ioctl failure contexts . . .

sys/netpfil/pf/ioctl/validation:clrtstats  ->  failed: Request with size =
-1 failed=20

is actually at least associated with a ioctl use:

ATF_TC_BODY(clrtstats, tc)
{
        struct pfioc_table io;
        struct pfr_table tbl;
        int flags;
                 COMMON_HEAD();
                 flags =3D 0;
                 common_init_tbl(&tbl);

        bzero(&io, sizeof(io));
        io.pfrio_flags =3D flags;
        io.pfrio_buffer =3D &tbl;
        io.pfrio_esize =3D sizeof(tbl);
                         /* Negative size. This will succeed, because =
the kernel will not copy
         * tables than it has. */
        io.pfrio_size =3D -1;
        if (ioctl(dev, DIOCRCLRTSTATS, &io) !=3D 0)
                atf_tc_fail("Request with size -1 failed ");

DIOCGETSRCNODES, DIOCRGETTABLES, DIOCRGETTSTATS, and DIOCRSETTFLAGS
are similar and get the notice as well.

The earlier aio_test examples are from:

static int
aio_md_setup(void)
{
        int error, fd, mdctl_fd, unit;
        char pathname[PATH_MAX];
        struct md_ioctl mdio;
        char buf[80];
=20
        ATF_REQUIRE_KERNEL_MODULE("aio");
=20
        mdctl_fd =3D open("/dev/" MDCTL_NAME, O_RDWR, 0);
        ATF_REQUIRE_MSG(mdctl_fd !=3D -1,
            "opening /dev/%s failed: %s", MDCTL_NAME, strerror(errno));
=20
        bzero(&mdio, sizeof(mdio));
        mdio.md_version =3D MDIOVERSION;
        mdio.md_type =3D MD_MALLOC;
        mdio.md_options =3D MD_AUTOUNIT | MD_COMPRESS;
        mdio.md_mediasize =3D GLOBAL_MAX;
        mdio.md_sectorsize =3D 512;
        strlcpy(buf, __func__, sizeof(buf));
        mdio.md_label =3D buf;

        if (ioctl(mdctl_fd, MDIOCATTACH, &mdio) < 0) {
                error =3D errno;
                errno =3D error;
                atf_tc_fail("ioctl MDIOCATTACH failed: %s", =
strerror(errno));
        }
. . .


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BD17072E-922F-48B0-BB0C-4447D07B0AA3>