<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/dev/mpr, branch releng/14.2</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>mps/mpr: Add workaround for firmware not responding to IOC_FACTS or IOC_INIT</title>
<updated>2024-10-16T14:19:21+00:00</updated>
<author>
<name>prateek sethi</name>
<email>prateekrootkey@gmail.com</email>
</author>
<published>2024-10-13T18:38:54+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b57229a80465b390a31fb30b3127c4cb93d8987f'/>
<id>b57229a80465b390a31fb30b3127c4cb93d8987f</id>
<content type='text'>
Sometimes, especially with older firmware, mps(4) would have trouble
initializing the card in one of these two steps. Add in a retry after a
short delay. Sean Bruno and Stephen McConnell thought this was OK in the
bug discussions, but never committed it.  Steve indicated the delay
might not be necessary, but the OP clearly needed to make it longer to
make things work. I've kept the delay, and added the suggested comment.

Ported the iocfacts part to mpr as well, since we see similar errors
about once every month or two over a few thousand controllers at
work. We've not seen it with IOC_INIT as far back as I can query the
error log database, so I didn't port that forward. We'll see if this
helps, but won't know for sure until next year (so I'm committing it now
since it won't hurt and might help). We usually see this failure in
connection with complicated recovery operations with a drive that's
failing, though, at least in the last year's worth of failures. It's
not clear this is the same as OP or not.

PR: 212841
Sponsored by: Netflix
Co-authored-by: imp

(cherry picked from commit c0e0e530ced057502f51d7a6086857305e08fae0)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sometimes, especially with older firmware, mps(4) would have trouble
initializing the card in one of these two steps. Add in a retry after a
short delay. Sean Bruno and Stephen McConnell thought this was OK in the
bug discussions, but never committed it.  Steve indicated the delay
might not be necessary, but the OP clearly needed to make it longer to
make things work. I've kept the delay, and added the suggested comment.

Ported the iocfacts part to mpr as well, since we see similar errors
about once every month or two over a few thousand controllers at
work. We've not seen it with IOC_INIT as far back as I can query the
error log database, so I didn't port that forward. We'll see if this
helps, but won't know for sure until next year (so I'm committing it now
since it won't hurt and might help). We usually see this failure in
connection with complicated recovery operations with a drive that's
failing, though, at least in the last year's worth of failures. It's
not clear this is the same as OP or not.

PR: 212841
Sponsored by: Netflix
Co-authored-by: imp

(cherry picked from commit c0e0e530ced057502f51d7a6086857305e08fae0)
</pre>
</div>
</content>
</entry>
<entry>
<title>mpr: Handle errors from copyout() in ioctl handlers</title>
<updated>2024-01-02T00:29:55+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2023-12-26T01:42:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=d60d9b713a46cb03aef2c1c3304aa29b7b033d83'/>
<id>d60d9b713a46cb03aef2c1c3304aa29b7b033d83</id>
<content type='text'>
In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mpr(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by:	imp, asomers
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43177

(cherry picked from commit 68cc77a3b73ffda1e8ac891b9852faca833e11b7)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In preparation for adding a __result_use_check annotation to copyin()
and related functions, start checking for errors from copyout() in
the mpr(4) user command handler.  This should make it easier to catch
bugs.

Reviewed by:	imp, asomers
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43177

(cherry picked from commit 68cc77a3b73ffda1e8ac891b9852faca833e11b7)
</pre>
</div>
</content>
</entry>
<entry>
<title>Use xpt_path_sbuf() in few drivers</title>
<updated>2023-12-23T04:36:56+00:00</updated>
<author>
<name>Alexander Motin</name>
<email>mav@FreeBSD.org</email>
</author>
<published>2023-11-23T16:25:45+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=129c3aa4b2312e3e2d91e5688a4368fc3836db98'/>
<id>129c3aa4b2312e3e2d91e5688a4368fc3836db98</id>
<content type='text'>
xpt_path_string() is now a wrapper around xpt_path_sbuf().  Using it
to than concatenate result to another sbuf makes no sense.  Just call
xpt_path_sbuf() directly.

MFC after:	1 month

(cherry picked from commit 8c4ee0b22c98fc1e208dd133f617bd329cd10728)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
xpt_path_string() is now a wrapper around xpt_path_sbuf().  Using it
to than concatenate result to another sbuf makes no sense.  Just call
xpt_path_sbuf() directly.

MFC after:	1 month

(cherry picked from commit 8c4ee0b22c98fc1e208dd133f617bd329cd10728)
</pre>
</div>
</content>
</entry>
<entry>
<title>mpr, mps:  Establish busdma boundaries for memory pools</title>
<updated>2023-12-20T15:40:42+00:00</updated>
<author>
<name>Kenneth D. Merry</name>
<email>ken@FreeBSD.org</email>
</author>
<published>2023-12-14T20:05:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=504e85ade103b0c2cafefb2d9dea86e94aef779f'/>
<id>504e85ade103b0c2cafefb2d9dea86e94aef779f</id>
<content type='text'>
Most all of the memory used by the cards in the mpr(4) and mps(4)
drivers is required, according to the specs and Broadcom developers,
to be within a 4GB segment of memory.

This includes:

System Request Message Frames pool
Reply Free Queues pool
ReplyDescriptorPost Queues pool
Chain Segments pool
Sense Buffers pool
SystemReply message pool

We got a bug report from Dwight Engen, who ran into data corruption
in the BAE port of FreeBSD:

&gt; We have a port of the FreeBSD mpr driver to our kernel and recently
&gt; I found an issue under heavy load where a DMA may go to the wrong
&gt; address. The test system is a Supermicro X10SRH-CLN4F with the
&gt; onboard SAS3008 controller setup with 2 enterprise Micron SSDs in
&gt; RAID 0 (striped). I have debugged the issue and narrowed down that
&gt; the errant DMA is one that has a segment that crosses a 4GB
&gt; physical boundary.  There are more details I can provide if you'd
&gt; like, but with the attached patch in place I can no longer
&gt; re-create the issue.

&gt; I'm not sure if this is a known limit of the card (have not found a
&gt; datasheet/programming docs for the chip) or our system is just
&gt; doing something a bit different. Any helpful info or insight would
&gt; be welcome.

&gt; Anyway, just thought this might be helpful info if you want to
&gt; apply a similar fix to FreeBSD. You can ignore/discard the commit
&gt; message as it is my internal commit (blkio is our own tool we use
&gt; to write/read every block of a device with CRC verification which
&gt; is how I found the problem).

The commit message was:

&gt; [PATCH 8/9] mpr: fix memory corrupting DMA when sg segment crosses
&gt; 4GB boundary

&gt; Test case was two SSD's in RAID 0 (stripe). The logical disk was
&gt; then partitioned into two partitions. One partition had lots of
&gt; filesystem I/O and the other was initially filled using blkio with
&gt; CRCable data and then read back with blkio CRC verify in a loop.
&gt; Eventually blkio would report a bad CRC block because the physical
&gt; page being read-ahead into didn't contain the right data. If the
&gt; physical address in the arq/segs was for example 0x500003000 the
&gt; data would actually be DMAed to 0x400003000.

The original patch was against mpr(4) before busdma templates were
introduced, and only affected the buffer pool (sc-&gt;buffer_dmat) in
the mpr(4) driver. After some discussion with Dwight and the
LSI/Broadcom developers and looking through the driver, it looks
like most of the queues in the driver are ok, because they limit
the memory used to memory below 4GB. The buffer queue and the chain
frames seem to be the exceptions.

This is pretty much the same between the mpr(4) and mps(4) drivers.

So, apply a 4GB boundary limitation for the buffer and chain frame pools
in the mpr(4) and mps(4) drivers.

Reported by:	Dwight Engen &lt;dwight.engen@gmail.com&gt;
Reviewed by:	imp
Obtained from:	Dwight Engen &lt;dwight.engen@gmail.com&gt;
Differential Revision:	&lt;https://reviews.freebsd.org/D43008&gt;

(cherry picked from commit 264610a86e14f8e123d94c3c3bd9632d75c078a3)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Most all of the memory used by the cards in the mpr(4) and mps(4)
drivers is required, according to the specs and Broadcom developers,
to be within a 4GB segment of memory.

This includes:

System Request Message Frames pool
Reply Free Queues pool
ReplyDescriptorPost Queues pool
Chain Segments pool
Sense Buffers pool
SystemReply message pool

We got a bug report from Dwight Engen, who ran into data corruption
in the BAE port of FreeBSD:

&gt; We have a port of the FreeBSD mpr driver to our kernel and recently
&gt; I found an issue under heavy load where a DMA may go to the wrong
&gt; address. The test system is a Supermicro X10SRH-CLN4F with the
&gt; onboard SAS3008 controller setup with 2 enterprise Micron SSDs in
&gt; RAID 0 (striped). I have debugged the issue and narrowed down that
&gt; the errant DMA is one that has a segment that crosses a 4GB
&gt; physical boundary.  There are more details I can provide if you'd
&gt; like, but with the attached patch in place I can no longer
&gt; re-create the issue.

&gt; I'm not sure if this is a known limit of the card (have not found a
&gt; datasheet/programming docs for the chip) or our system is just
&gt; doing something a bit different. Any helpful info or insight would
&gt; be welcome.

&gt; Anyway, just thought this might be helpful info if you want to
&gt; apply a similar fix to FreeBSD. You can ignore/discard the commit
&gt; message as it is my internal commit (blkio is our own tool we use
&gt; to write/read every block of a device with CRC verification which
&gt; is how I found the problem).

The commit message was:

&gt; [PATCH 8/9] mpr: fix memory corrupting DMA when sg segment crosses
&gt; 4GB boundary

&gt; Test case was two SSD's in RAID 0 (stripe). The logical disk was
&gt; then partitioned into two partitions. One partition had lots of
&gt; filesystem I/O and the other was initially filled using blkio with
&gt; CRCable data and then read back with blkio CRC verify in a loop.
&gt; Eventually blkio would report a bad CRC block because the physical
&gt; page being read-ahead into didn't contain the right data. If the
&gt; physical address in the arq/segs was for example 0x500003000 the
&gt; data would actually be DMAed to 0x400003000.

The original patch was against mpr(4) before busdma templates were
introduced, and only affected the buffer pool (sc-&gt;buffer_dmat) in
the mpr(4) driver. After some discussion with Dwight and the
LSI/Broadcom developers and looking through the driver, it looks
like most of the queues in the driver are ok, because they limit
the memory used to memory below 4GB. The buffer queue and the chain
frames seem to be the exceptions.

This is pretty much the same between the mpr(4) and mps(4) drivers.

So, apply a 4GB boundary limitation for the buffer and chain frame pools
in the mpr(4) and mps(4) drivers.

Reported by:	Dwight Engen &lt;dwight.engen@gmail.com&gt;
Reviewed by:	imp
Obtained from:	Dwight Engen &lt;dwight.engen@gmail.com&gt;
Differential Revision:	&lt;https://reviews.freebsd.org/D43008&gt;

(cherry picked from commit 264610a86e14f8e123d94c3c3bd9632d75c078a3)
</pre>
</div>
</content>
</entry>
<entry>
<title>mprutil: "fix user reply buffer (64)..." warnings</title>
<updated>2023-10-03T01:31:12+00:00</updated>
<author>
<name>Alan Somers</name>
<email>asomers@FreeBSD.org</email>
</author>
<published>2023-02-22T22:06:43+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c70a4185c637754428f36536af3bdc9181fa5155'/>
<id>c70a4185c637754428f36536af3bdc9181fa5155</id>
<content type='text'>
Depending on the card's firmware version, it may return different length
responses for MPI2_FUNCTION_IOC_FACTS.  But the first part of the
response contains the length of the rest, so query it first to get the
length and then use that to size the buffer for the full response.

Also, correctly zero-initialize MPI2_IOC_FACTS_REQUEST.  It only worked
by luck before.

PR:		264848
Reported by:	Julien Cigar &lt;julien@perdition.city&gt;
Sponsored by:	Axcient
Reviewed by:	scottl, imp
Differential Revision: https://reviews.freebsd.org/D38739

(cherry picked from commit 7d154c4dc64e61af7ca536c4e9927fa07c675a83)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Depending on the card's firmware version, it may return different length
responses for MPI2_FUNCTION_IOC_FACTS.  But the first part of the
response contains the length of the rest, so query it first to get the
length and then use that to size the buffer for the full response.

Also, correctly zero-initialize MPI2_IOC_FACTS_REQUEST.  It only worked
by luck before.

PR:		264848
Reported by:	Julien Cigar &lt;julien@perdition.city&gt;
Sponsored by:	Axcient
Reviewed by:	scottl, imp
Differential Revision: https://reviews.freebsd.org/D38739

(cherry picked from commit 7d154c4dc64e61af7ca536c4e9927fa07c675a83)
</pre>
</div>
</content>
</entry>
<entry>
<title>sys: Remove $FreeBSD$: one-line .c pattern</title>
<updated>2023-08-16T17:54:36+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=685dc743dc3b5645e34836464128e1c0558b404b'/>
<id>685dc743dc3b5645e34836464128e1c0558b404b</id>
<content type='text'>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
</pre>
</div>
</content>
</entry>
<entry>
<title>sys: Remove $FreeBSD$: two-line .h pattern</title>
<updated>2023-08-16T17:54:11+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=95ee2897e98f5d444f26ed2334cc7c439f9c16c6'/>
<id>95ee2897e98f5d444f26ed2334cc7c439f9c16c6</id>
<content type='text'>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</pre>
</div>
</content>
</entry>
<entry>
<title>mpr: Fix minor 'typos' comment</title>
<updated>2023-07-20T23:18:28+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-07-20T23:16:04+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=59dc489a7e034674c3f52c56c95851bf31dc790b'/>
<id>59dc489a7e034674c3f52c56c95851bf31dc790b</id>
<content type='text'>
moving -&gt; removing (we're removing the device)
CAM_REQ_CMO_ERROR -&gt; CAM_REQ_ERR (the former isn't a thing)

Sponsored by:		Netflix
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
moving -&gt; removing (we're removing the device)
CAM_REQ_CMO_ERROR -&gt; CAM_REQ_ERR (the former isn't a thing)

Sponsored by:		Netflix
</pre>
</div>
</content>
</entry>
<entry>
<title>mpr: don't use hardcoded value in debug branch</title>
<updated>2023-04-21T08:01:38+00:00</updated>
<author>
<name>Mariusz Zaborski</name>
<email>oshogbo@FreeBSD.org</email>
</author>
<published>2023-04-21T07:57:38+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=444c6615459efe2b015deb1cffc54fcaa3ea1fca'/>
<id>444c6615459efe2b015deb1cffc54fcaa3ea1fca</id>
<content type='text'>
Pointed out by:	imp
Sponsored by:   Klara Inc.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pointed out by:	imp
Sponsored by:   Klara Inc.
</pre>
</div>
</content>
</entry>
<entry>
<title>mpr: fix copying of event_mask</title>
<updated>2023-04-21T08:01:38+00:00</updated>
<author>
<name>Mariusz Zaborski</name>
<email>oshogbo@FreeBSD.org</email>
</author>
<published>2023-04-21T07:50:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ea6597c38c77c7bfaae71259d8636cbb89add6a3'/>
<id>ea6597c38c77c7bfaae71259d8636cbb89add6a3</id>
<content type='text'>
Before the commit 6cc44223cb6717795afdac4348bbe7e2a968a07d the
field event_mask was fully copied to the EventMasks field.
After this commit the event_mask (uint8_t) is 4 times casted to
EventMask (uint32_t). Because of that 24 bits of each event_mask array
is lost.

This commits brings back simple copying of field, and after words
converting 32 bits field to the requested endian.

I don't think we need more sophisticated method,
as the array is of size 4 (for 32 bits version).

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D39562
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before the commit 6cc44223cb6717795afdac4348bbe7e2a968a07d the
field event_mask was fully copied to the EventMasks field.
After this commit the event_mask (uint8_t) is 4 times casted to
EventMask (uint32_t). Because of that 24 bits of each event_mask array
is lost.

This commits brings back simple copying of field, and after words
converting 32 bits field to the requested endian.

I don't think we need more sophisticated method,
as the array is of size 4 (for 32 bits version).

Reviewed by:	imp
MFC after:	1 week
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D39562
</pre>
</div>
</content>
</entry>
</feed>
