From owner-freebsd-scsi@freebsd.org  Tue Nov 13 18:02:39 2018
Return-Path: <owner-freebsd-scsi@freebsd.org>
Delivered-To: freebsd-scsi@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 D6AB7112C4E7
 for <freebsd-scsi@mailman.ysv.freebsd.org>;
 Tue, 13 Nov 2018 18:02:38 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org
 [IPv6:2001:1900:2254:206a::50:5])
 by mx1.freebsd.org (Postfix) with ESMTP id 41F50705DA
 for <freebsd-scsi@freebsd.org>; Tue, 13 Nov 2018 18:02:38 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: by mailman.ysv.freebsd.org (Postfix)
 id 02D74112C4E4; Tue, 13 Nov 2018 18:02:38 +0000 (UTC)
Delivered-To: scsi@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 D4A81112C4E3;
 Tue, 13 Nov 2018 18:02:37 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com
 [64.147.123.25])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id D3EA6705D7;
 Tue, 13 Nov 2018 18:02:35 +0000 (UTC)
 (envelope-from scottl@samsco.org)
Received: from compute6.internal (compute6.nyi.internal [10.202.2.46])
 by mailout.west.internal (Postfix) with ESMTP id AD3D13CF;
 Tue, 13 Nov 2018 13:02:27 -0500 (EST)
Received: from mailfrontend1 ([10.202.2.162])
 by compute6.internal (MEProxy); Tue, 13 Nov 2018 13:02:27 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h=
 content-type:mime-version:subject:from:in-reply-to:date:cc
 :content-transfer-encoding:message-id:references:to; s=fm1; bh=U
 P34BGG1g4P1l6baWnDOhKU+PNkW77ED4DUg2SbcpcQ=; b=MswhBgOBJJ1pOVr7E
 iKabJUqtEZ7z1YD0yX6A6Z5iJd9r2ryomMEbmQrZAZjwzfdVsbnDuJ5Ir1Db9J6p
 z/xLm+Q8K4nPGzN8BenQN2pULJIfOQzVJ0ACnATd63zUJODTHCknPKUY5kSfaGH7
 pEPZSiqRqh8ErllyyVQT1EQKSd1UMJz0PqlJonnQcKQiUNotsIebf1tCzWSyCmHP
 +aGY7oKUcd3wLVXQejZXCquySboT1eUc3shzlEzDqhOrtLLadrwNUjt5thlfKO9j
 YBjnnLg54Ca9AjRFMR9S88fmjIhNRzH4I//MWKHqpMwlccdgq+orQZt/34grdNaX
 RPLRg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; bh=UP34BGG1g4P1l6baWnDOhKU+PNkW77ED4DUg2Sbcp
 cQ=; b=Baw5KMY6ofLmLREjwzyKBcl1xlffw+QBuH2CJj/jKaV/CESL7dtIt5P/i
 pZj1ofSQ8Ltji+ouOFLzBzKasOUPNJOTuH+IErH749y3u9LwCvpUDsR6mwo5YbYx
 n1yY4qM4IWstk+aGIp0fwGhoar+NxbNooolF3FGMW3Hrh33JmwEb34Qp6/Ptrv6f
 P1Mr/M9QlUZccueDQYNoCAudB6M16eUo+m+Q0Y3IE8QwPfELmqRx+AX2XzQ5GrQe
 tNwHqGaZIhbug9+y98vaWe4vCf9W5pwqdVIuv865o/aRxfmrlu1NMb1AN5B0qTWY
 nPCkIZcoejfdwcRUxh0HWBoN6YQTA==
X-ME-Sender: <xms:shHrW7HXQvK8IlRs3rD_FaK9xhwToWQcN0XMz2iDSV8y5L5LmISz0g>
X-ME-Proxy: <xmx:shHrW9PvHvml5Kr0ufFKNUrFwNJhTRJ1whjj-uR84bC_N2neRMpfXw>
 <xmx:shHrW490nkVf9As_xNSYIN50FcRwcgyGpYBLRwcrVGgBMQpsaA2vxQ>
 <xmx:shHrW18u4S1MeTa8w3pdacU0i_o5neq3qYJWC1cWpVnBlzUFW1mZZQ>
 <xmx:shHrWwpoah6p877grvEtHoCV3yqy9d0xAf3YQyOhP35zdkSVYiE7Vg>
 <xmx:shHrW4JkxuPh86RdcDf5ljo7BsWle2VJX0vaBVocOajlCtkceJNa-Q>
 <xmx:sxHrWwa92z9iW0n-g--RcMD_U-7m2pVPRail6H2dCxiq7vWr2GH90w>
Received: from [192.168.0.137] (unknown [8.46.89.213])
 by mail.messagingengine.com (Postfix) with ESMTPA id 5EA0DE49CA;
 Tue, 13 Nov 2018 13:02:26 -0500 (EST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\))
Subject: Re: MSI allocation regression, still to be corrected in HEAD and
 please MFC before release/12.0 gets branched
From: Scott Long <scottl@samsco.org>
In-Reply-To: <042090da-f73f-ce80-517c-0b1729d3d6e1@omnilan.de>
Date: Tue, 13 Nov 2018 11:02:25 -0700
Cc: scsi@freebsd.org,
 freebsd-stable <freebsd-stable@freebsd.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <05D94EC4-D797-4246-96B5-6DC1494E7EA9@samsco.org>
References: <201707300653.v6U6rwLN099096@repo.freebsd.org>
 <597DA578.6030101@omnilan.de> <597F56A8.1060603@omnilan.de>
 <D18DFAD4-6E93-4AE2-BE15-EFF4D8ABCB2A@samsco.org>
 <59804C8C.1020003@omnilan.de>
 <e7d94e6a-89e8-ffa1-40da-7fb67e6bfc2b@omnilan.de>
 <78611650-D7A4-4B1D-A254-DB058E1AC1C6@samsco.org>
 <d99e383d-b09a-f3bd-f1e2-a6a808016347@omnilan.de>
 <A2AECF9F-2BB1-4FC0-8330-658336A3A4F0@samsco.org>
 <6e1e5f9f-4ece-dc9d-b059-08d52c9e6965@omnilan.de>
 <042090da-f73f-ce80-517c-0b1729d3d6e1@omnilan.de>
To: Harry Schmalzbauer <freebsd@omnilan.de>
X-Mailer: Apple Mail (2.3445.100.39)
X-Rspamd-Queue-Id: 41F50705DA
X-Spamd-Result: default: False [-7.04 / 200.00]; ARC_NA(0.00)[];
 RCVD_VIA_SMTP_AUTH(0.00)[];
 R_DKIM_ALLOW(-0.20)[samsco.org,messagingengine.com];
 RCVD_COUNT_SEVEN(0.00)[7]; R_SPF_NEUTRAL(0.00)[?all];
 FROM_HAS_DN(0.00)[]; MV_CASE(0.50)[];
 RCPT_COUNT_THREE(0.00)[3]; MIME_GOOD(-0.10)[text/plain];
 DMARC_NA(0.00)[samsco.org]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[];
 TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+];
 RCVD_IN_DNSWL_MED(-0.20)[5.0.0.0.0.5.0.0.0.0.0.0.0.0.0.0.a.6.0.2.4.5.2.2.0.0.9.1.1.0.0.2.list.dnswl.org
 : 127.0.9.2]; 
 MX_GOOD(-0.01)[cached: in2-smtp.messagingengine.com];
 NEURAL_HAM_SHORT(-0.94)[-0.935,0]; RCVD_NO_TLS_LAST(0.10)[];
 FROM_EQ_ENVFROM(0.00)[];
 IP_SCORE(-3.69)[ip: (-9.85), ipnet: 2001:1900:2254::/48(-4.79), asn:
 10310(-3.73), country: US(-0.09)]; 
 ASN(0.00)[asn:10310, ipnet:2001:1900:2254::/48, country:US];
 FORGED_RECIPIENTS(0.00)[scsi@freebsd.org ..,freebsd-scsi@freebsd.org];
 MID_RHS_MATCH_FROM(0.00)[]
X-Rspamd-Server: mx1.freebsd.org
X-BeenThere: freebsd-scsi@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SCSI subsystem <freebsd-scsi.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-scsi>,
 <mailto:freebsd-scsi-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-scsi/>
List-Post: <mailto:freebsd-scsi@freebsd.org>
List-Help: <mailto:freebsd-scsi-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-scsi>,
 <mailto:freebsd-scsi-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 13 Nov 2018 18:02:39 -0000



> On Nov 12, 2018, at 10:03 AM, Harry Schmalzbauer <freebsd@omnilan.de> =
wrote:
>=20
> Am 11.06.2018 um 20:28 schrieb Harry Schmalzbauer:
>> Am 05.06.2018 um 19:54 schrieb Scott Long:
>> =E2=80=A6
>>>>>> Late in the 11.2 phase, I identified this commit as a regression =
for MSI (non-x) alloctaion.
>>>>>> I have an idea what probably causes the problem here (INTx =
allocation, although MSI (and MSI-x) capability):
>>>>>> disable_msix is not 0 (I need to disable MSI-x because of =
ESXi-passthru=E2=80=A6).
>>>>>>=20
>>>>>> Corresponding lines:
>>>>>> {
>>>>>>          device_t dev;
>>>>>>          int error, msgs;
>>>>>>=20
>>>>>>          dev =3D sc->mps_dev;
>>>>>>          error =3D 0;
>>>>>>          msgs =3D 0;
>>>>>>=20
>>>>>>          if ((sc->disable_msix =3D=3D 0) &&
>>>>>>              ((msgs =3D pci_msix_count(dev)) >=3D MPS_MSI_COUNT))
>>>>>>                  error =3D mps_alloc_msix(sc, MPS_MSI_COUNT);
>>>>>>          if ((error !=3D 0) && (sc->disable_msi =3D=3D 0) &&
>>>>>>              ((msgs =3D pci_msi_count(dev)) >=3D MPS_MSI_COUNT))
>>>>>>                  error =3D mps_alloc_msi(sc, MPS_MSI_COUNT);
>>>>>>          if (error !=3D 0)
>>>>>>                  msgs =3D 0;
>>>>>>=20
>>>>>>          sc->msi_msgs =3D msgs;
>>>>>>          return (error);
>>>>>> }
>>>>>>=20
> =E2=80=A6
>>>>> Hi Harry,
>>>>> You are correct about the bug.  Please change the line at the top =
of the function that reads
>>>>> error =3D 0;
>>>>> to
>>>>> error =3D ENXIO;
>>>>> Let me know if that fixes the MSI problem for you.
>>=20
>> =E2=80=A6
>>=20
> =E2=80=A6
>> Index: src/sys/dev/mps/mps_pci.c
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> --- sys/dev/mps/mps_pci.c   (Revision 334948)
>> +++ sys/dev/mps/mps_pci.c   (Arbeitskopie)
>> @@ -244,7 +244,7 @@
>>         int error, msgs;
>>=20
>>         dev =3D sc->mps_dev;
>> -       error =3D 0;
>> +       error =3D ENXIO;
>>         msgs =3D 0;
>>=20
>>         if ((sc->disable_msix =3D=3D 0) &&
>>=20
>=20
> To my understanding, it's obvious that the way =
mps_pci_alloc_interrupts() currently works is unintended.
> This might not affect too many people, but is there a reason not to =
fix it?
>=20
> I already created a coresponding problem report: =
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229267
> Anything else I should do?
>=20

Hi Harry,

Sorry for ignoring this for so long.  I=E2=80=99m going to commit a fix =
today, but it won=E2=80=99t be the same one-line change.
Upon reviewing the code, I=E2=80=99d going to refactor it so it=E2=80=99s =
not so confusing and prone to these kinds of mistakes.
Thank you for the continued reminders to finish this.

Scott