From owner-dev-commits-src-all@freebsd.org Wed Jun 9 17:52:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DB02651581; Wed, 9 Jun 2021 17:52:24 +0000 (UTC) (envelope-from dab0816@gmail.com) Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G0ZSR2jzTz3Dtr; Wed, 9 Jun 2021 17:52:23 +0000 (UTC) (envelope-from dab0816@gmail.com) Received: by mail-io1-xd2f.google.com with SMTP id b25so23684339iot.5; Wed, 09 Jun 2021 10:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=Ap6wqQFQS8zYmq3KpW/N+I98IUd/mBulNO6B13rH5Ks=; b=uJ8Qz9rptWczpYIn73q5kmBWvRTx3oSROk/n2j6WFHZRY2v0K7CzK/XHRNECmu7XTQ hlDqpeU0e8SFmZAzTp+KlWd3CT/uslB26EC8JaG2oTTU0uR8mWMhb6GAigJM0rMMaqqJ cxXkonvQt19FNKvLrPfzGycLASqvyJan7j6saU71x5jk28LNHfyim+zlLDOA/jzKTm19 GMLO4ri5/TdhO3qm5Sn5vRgpu6Ba7PY7By5gq5/AmU+Lql6t7HvLRCTCQiWAm6BKo7wU CtW2QMfV8dIh5m7+rPcsrbrYEtLti0V0cCQloLBNXLmfenbpOaJeiVp15GRyu+pBgXnK wKWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=Ap6wqQFQS8zYmq3KpW/N+I98IUd/mBulNO6B13rH5Ks=; b=MlnROE2RadofsI6SEy/3ARClEDF/iVXVbIdbkh1AdE2zzOaILLvOCJaP7sZ8DOJDJI hshDLOmXUG6nD0YjHNV4mj61Z7Psgv157fY/LiOuQKIEO0E8PUiF5eup9QjrphzM8ksF gCVYpwF796t63tonYGm+TmKiZSEi/Y72n3tLSigbIqgNJkj5wey17gqgV0peGZG5iucT IS45x1JIwP5r+o9RfSvjERXUz7wGDmI1Qzupbr3zU55Q3czPzZaGjHpzuX2nfnoQ1TxW Wno65zT38mJe4t/HrWMs68h6S5DB1sLxV81WEnbGEYAQ/5fWo3pXaHVlK4XZU4zWS4E6 D8kg== X-Gm-Message-State: AOAM530pAhQ2mgE+B1HxZu2aXJhhIIY2XBf+WnEm+nU3TE0inSBGA3rH 1fO4NE6Y85htMlguXhH6ZhcVLooR0l8= X-Google-Smtp-Source: ABdhPJyyJII+tPLJlWcoHsi/+wnC7MZmhCxKpaP9M9m1uHAqlcvUJ7NIM5QlXt4GOFH1V3eK80eE2A== X-Received: by 2002:a6b:6410:: with SMTP id t16mr516601iog.78.1623261141921; Wed, 09 Jun 2021 10:52:21 -0700 (PDT) Received: from smtpclient.apple ([135.129.115.77]) by smtp.gmail.com with ESMTPSA id z16sm375336ilp.73.2021.06.09.10.52.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jun 2021 10:52:21 -0700 (PDT) Sender: David Bright From: David Bright X-Google-Original-From: David Bright Message-Id: <6E4EA1A3-BEEB-4D7B-BB21-EAB13A07A9C2@FreeBSD.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 2f176a2b2010 - main - pciconf: Fix up pciconf -lc output Date: Wed, 9 Jun 2021 12:52:18 -0500 In-Reply-To: <93b7adea-1980-b097-cdf1-d3426dd0d531@FreeBSD.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: John Baldwin References: <202106011556.151Fu6ZE084734@gitrepo.freebsd.org> <93b7adea-1980-b097-cdf1-d3426dd0d531@FreeBSD.org> X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4G0ZSR2jzTz3Dtr X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=uJ8Qz9rp; dmarc=none; spf=pass (mx1.freebsd.org: domain of dab0816@gmail.com designates 2607:f8b0:4864:20::d2f as permitted sender) smtp.mailfrom=dab0816@gmail.com X-Spamd-Result: default: False [0.30 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[david@bright-family.net,dab0816@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[135.129.115.77:received]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[david@bright-family.net,dab0816@gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::d2f:from]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[bright-family.net]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::d2f:from:127.0.2.255]; MID_RHS_MATCH_TO(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::d2f:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2021 17:52:24 -0000 On Jun 1, 2021, at 12:44 PM, John Baldwin wrote: >=20 > On 6/1/21 8:56 AM, David Bright wrote: >> The branch main has been updated by dab: >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D2f176a2b20107f7a9132242223e9eef6= 57400514 >> commit 2f176a2b20107f7a9132242223e9eef657400514 >>=20 >> pciconf: Fix up pciconf -lc output >> The pciconf command fails to emit newlines when particular = ecap field >> values are seen. Fix them up. This has been seen on several = systems at >> $JOB. The documentation for PCI capabilities says that capability >> type 0 should not be used once the spec for PCI capabilities was >> published, but that seems more wishful-thinking than reality. = pciconf >> also chooses not to print fields related to field values that are >> zero, but it seems several of these fields are zero on actual >> hardware. >>=20 >=20 > Are the ecap registers actually valid for version 1 in this case? = That is, > should we treat version 0 as being version 1? The current checks are = just > defensive coding for not parsing something unless we know it is valid. > If the only version 0 caps in practice are always compatible with = version 1 > we could just treat 0 as if it were 1. I think the answer is =E2=80=9Cmaybe, but we don=E2=80=99t know for = sure=E2=80=9D. Robert Herndon did some looking at this; his findings are = paraphrased below: ----- Searching on version fields in PCI caps and ecaps doesn=E2=80=99t = produce a lot of information. There are references to particular devices = indicating that =E2=80=98version=E2=80=99 should be =E2=80=981=E2=80=99, = or that it should not be =E2=80=980=E2=80=99, but there=E2=80=99s = nothing that says so for any generic case, or in the standards I=E2=80=99v= e found. The version field is only four bits, so it seems a little odd = that zero wouldn=E2=80=99t be a reasonable-ish value. Internally we have = only found two hosts exhibiting this issue and both exhibit the same = behavior. When the early return on version 0 is disabled they show = multiple instances of: cap 10[40] =3D PCI-Express 2 root endpoint max data 128(128) ecap 000b[100] =3D Vendor 0 ID 1 none114@pci0:93:15:0: class=3D0x110100 card=3D0x00008086 = chip=3D0x20588086 rev=3D0x07 hdr=3D0x00 So they appear to be mainstream vendor (Intel) devices. All instances = showed =E2=80=98Vendor 0 ID 1=E2=80=99. In this particular instance, the = current FreeBSD code would print this much information and a little more = before refusing to dump more detailed information, printing printf("Vendor [%d] ID %04x Rev %d Length %d\n", ver, PCIR_VSEC_ID(hdr), PCIR_VSEC_REV(hdr), len); before returning. (After the return, it does read more registers out of = the capability, and prints more detailed information for extra registers = as found). It=E2=80=99s conceivable that reading these registers when a particular = field is zero could cause it to print erroneous or misleading = information, but there is a reasonable probability that it would be = helpful in real usage.=20 ----- --=20 David Bright dab@FreeBSD.org