Page MenuHomeFreeBSD
Feed Advanced Search

Jul 24 2016

jah added a comment to D3989: Update powerpc busdma to handle unmapped/out-of-context buffers.

Did some light testing, but not sure if I triggered anything.

Jul 24 2016, 6:32 PM

May 29 2016

jah committed rS300948: MFC r300258:.
MFC r300258:
May 29 2016, 7:15 AM

May 20 2016

jah committed rS300258: iic_rdwr_data->nmsgs is uint32_t, so limit the allowable number of messages….
iic_rdwr_data->nmsgs is uint32_t, so limit the allowable number of messages…
May 20 2016, 3:03 AM
jah closed D5155: Add some missing integrity checks in iicrdwr() by committing rS300258: iic_rdwr_data->nmsgs is uint32_t, so limit the allowable number of messages….
May 20 2016, 3:03 AM

May 19 2016

jah updated the diff for D5155: Add some missing integrity checks in iicrdwr().

Add comment noting size limit of each message

May 19 2016, 2:12 PM
jah retitled D5155: Add some missing integrity checks in iicrdwr() from Check the results of copyin(9) before continuing in iicrdwr(..) to Add some missing integrity checks in iicrdwr().
May 19 2016, 2:02 PM
jah updated the diff for D5155: Add some missing integrity checks in iicrdwr().

Limit number of messages to 42 to prevent exhaustion/short allocation on 32-bit systems

May 19 2016, 1:48 PM
jah commandeered D5155: Add some missing integrity checks in iicrdwr().
May 19 2016, 1:46 PM

May 16 2016

jah added a comment to D3989: Update powerpc busdma to handle unmapped/out-of-context buffers.

I think qemu can boot powerpc64 (see https://wiki.freebsd.org/QemuRecipes ). What kinds of testing should be done? I have a Book-E board I could boot test with, and do basic SATA I/O, would that be enough? I also have some PowerMac hardware. Would need a week or two before I can test with that though.

May 16 2016, 2:49 AM

May 15 2016

jah added a comment to D5155: Add some missing integrity checks in iicrdwr().

Garrett, were you planning to add the limit on nmsgs and commit this? If not, I can do it.

May 15 2016, 8:30 PM
jah added a comment to D3989: Update powerpc busdma to handle unmapped/out-of-context buffers.

This one's been sitting for a while. Anything I can do to test this out on my own? qemu maybe?

May 15 2016, 8:23 PM

Apr 14 2016

jah added a comment to D5917: busdma/bounce: force bouncing of full buffer.

I think it's better to revert r292255 than to add this. Like Hans mentioned it adds complexity, and the fact that it forces entire buffers to be bounced seems wrong to me. The added memcpy probably isn't that big of a deal, since performance goes out the window if you're bouncing anyway. But the memory those bounce pages come from is likely to be somewhat precious. This could make large transfers use a lot more of that, which makes me nervous.

Apr 14 2016, 2:16 PM

Feb 1 2016

jah added a comment to D5155: Add some missing integrity checks in iicrdwr().
In D5155#109705, @kib wrote:

Copy/paste from my mail to the OP:

> > $ svn diff iic.c 
> > Index: iic.c
> > ===================================================================
> > --- iic.c       (revision 295081)
> > +++ iic.c       (working copy)
> > @@ -303,6 +303,10 @@
> >         buf = malloc(sizeof(*d->msgs) * d->nmsgs, M_IIC, M_WAITOK);
> >  
> >         error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
> > +       if (error != 0) {
> > +               free(buf, M_IIC);
> > +               return (error);
> > +       }
> >  
> >         /* Alloc kernel buffers for userland data, copyin write data */
> >         usrbufs = malloc(sizeof(void *) * d->nmsgs, M_IIC, M_WAITOK | M_ZERO);
> > 
> This just continues the original bug.
> 
> If you look at the line above the changed line, you would see the
> multiplication with the user-supplied value, which could e.g. overflow
> and results in the short buffer being malloced. Then copying trashes the
> kernel heap.
> 
> That said, even if overflow does not occur, the user-controlled malloc(9)
> either causes DoS by over-allocation of the kernel memory, or by causing
> panic by exhausting the kmem address space on 32bit arches.
Feb 1 2016, 3:52 PM
jah accepted D5155: Add some missing integrity checks in iicrdwr().
Feb 1 2016, 6:48 AM
jah added a comment to D5155: Add some missing integrity checks in iicrdwr().

I might've missed something, but it looks like we don't actually use the contents of buf for anything if error is set. We might store some of that bogus data in usrbufs at line 311, but we'll avoid using it.

Feb 1 2016, 6:48 AM

Nov 18 2015

jah accepted D4120: ARM: Fix dma_dcache_sync().
Nov 18 2015, 3:20 PM

Nov 14 2015

jah added inline comments to D4120: ARM: Fix dma_dcache_sync().
Nov 14 2015, 8:38 AM

Oct 28 2015

jah added a comment to D3986: Update mips busdma to handle unmapped/out-of-context buffers.
In D3986#83956, @adrian wrote:

Just build some software or something that'll churn the VM and do disk IO. :)

Oct 28 2015, 10:21 PM
jah committed rS290120: Retire pmap_dmap_iscurrent(). It is only a wrapper around pmap_is_current()….
Retire pmap_dmap_iscurrent(). It is only a wrapper around pmap_is_current()…
Oct 28 2015, 9:17 PM
jah added a comment to D3986: Update mips busdma to handle unmapped/out-of-context buffers.
In D3986#83554, @adrian wrote:

Can you test this out via a qemu-system-mips (from qemu-devel) package?

https://github.com/freebsd/freebsd-wifi-build/wiki/MipsQemuEmulatorImages

Oct 28 2015, 4:00 AM

Oct 23 2015

jah updated the diff for D3989: Update powerpc busdma to handle unmapped/out-of-context buffers.

Remove unclear comment on PHYS_TO_VM_PAGE().
Noted by: avg

Oct 23 2015, 12:10 PM
jah updated the diff for D3986: Update mips busdma to handle unmapped/out-of-context buffers.

Remove unclear comments on PHYS_TO_VM_PAGE().
Noted by: avg

Oct 23 2015, 12:08 PM
jah committed rS289826: Fix capitalization.
Fix capitalization
Oct 23 2015, 12:06 PM
jah committed rS289825: Remove unclear comment about address truncation in busdma. Add (hopefully….
Remove unclear comment about address truncation in busdma. Add (hopefully…
Oct 23 2015, 12:03 PM

Oct 22 2015

jah added a reviewer for D3989: Update powerpc busdma to handle unmapped/out-of-context buffers: jhibbits.
Oct 22 2015, 10:05 PM
jah retitled D3989: Update powerpc busdma to handle unmapped/out-of-context buffers from to Update powerpc busdma to handle unmapped/out-of-context buffers.
Oct 22 2015, 10:02 PM
jah added a reviewer for D3986: Update mips busdma to handle unmapped/out-of-context buffers: adrian.
Oct 22 2015, 9:14 PM
jah retitled D3986: Update mips busdma to handle unmapped/out-of-context buffers from to Update mips busdma to handle unmapped/out-of-context buffers.
Oct 22 2015, 9:13 PM
jah committed rS289759: Use pmap_quick* functions in armv6 busdma, for bounce buffers and cache….
Use pmap_quick* functions in armv6 busdma, for bounce buffers and cache…
Oct 22 2015, 4:38 PM
jah closed D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers by committing rS289759: Use pmap_quick* functions in armv6 busdma, for bounce buffers and cache….
Oct 22 2015, 4:38 PM

Oct 21 2015

jah committed rS289717: Use pmap_quick* functions in arm64 busdma to make bounce buffer….
Use pmap_quick* functions in arm64 busdma to make bounce buffer…
Oct 21 2015, 7:44 PM
jah closed D3870: Use pmap_quick* in arm64 busdma by committing rS289717: Use pmap_quick* functions in arm64 busdma to make bounce buffer….
Oct 21 2015, 7:44 PM
jah added a comment to D888: x86/dma_bounce: rework _bus_dmamap_load_ma implementation.
In D888#82509, @royger wrote:
In D888#80533, @jah wrote:

Thinking about this some more, I wonder if it would be better to have add_bounce_page() do coalescing in much the same way as _bus_dmamap_addseg() already does. You'd still have the 2-page array in struct bounce_page, but add_bounce_page() would go back to just taking one address. It would look at the tail of map->bpages (if that exists). If that last bounce page can still fit the new segment with the right alignment, then its datacount will be increased and datapage[1] will be set if necessary. Otherwise, a new bounce page will be pulled from the bz queue.

With that scheme, you wouldn't need the dedicated load_ma or count_ma functions; existing load_phys and load_buffer would "do the right thing". We'd also make more efficient use of bounce pages when magsegz is much smaller than a page. Right now, if maxsegsz is, say, 512 and those 512-byte segments get bounced, each one will waste a whole bounce page. Of course, I doubt that's a common use case.

A downside would be that you'd probably need to duplicate some of the coalescing logic in count_phys and count_pages to avoid over-requesting bounce pages.

Just a thought I had; there are probably holes in that scheme that I haven't thought of.

The solution you are proposing seems fine, but I don't think I will have time to look into it until a couple of weeks, do you mind if I commit this now so we can get unmapped IO for blkfront?

Oct 21 2015, 1:13 PM
jah committed rS289675: Use pmap_quick* for out-of-context bounce buffers and (limited) cache….
Use pmap_quick* for out-of-context bounce buffers and (limited) cache…
Oct 21 2015, 4:53 AM
jah closed D3522: Use pmap_quick* in pre-v6 arm busdma implementation by committing rS289675: Use pmap_quick* for out-of-context bounce buffers and (limited) cache….
Oct 21 2015, 4:53 AM
jah updated the test plan for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.
Oct 21 2015, 4:52 AM

Oct 20 2015

jah updated the test plan for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.
Oct 20 2015, 9:54 AM
jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.

Narrow the scope of the temporary bounce buffer mappings

Oct 20 2015, 9:52 AM

Oct 18 2015

jah added inline comments to D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.
Oct 18 2015, 11:34 AM

Oct 17 2015

jah updated the diff for D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.

Fixed confusion of client page addr vs. bounce page addr, trimmed trailing whitespace

Oct 17 2015, 9:30 PM
jah added inline comments to D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.
Oct 17 2015, 9:08 PM
jah updated the diff for D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.

Comment on unaligned pages, move page array assertion back to dma_dcache_sync()

Oct 17 2015, 3:51 PM
jah committed rS289457: Don't page-align the physical address when calling PHYS_TO_VM_PAGE()..
Don't page-align the physical address when calling PHYS_TO_VM_PAGE().
Oct 17 2015, 2:59 PM
jah added inline comments to D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.
Oct 17 2015, 2:33 PM
jah updated the diff for D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.

Re-adding comment, moving POSTWRITE check to beginning of _bus_dmamap_sync() as is done for armv5 and mips

Oct 17 2015, 12:01 AM

Oct 16 2015

jah added inline comments to D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.
Oct 16 2015, 10:52 PM

Oct 13 2015

jah added a comment to D888: x86/dma_bounce: rework _bus_dmamap_load_ma implementation.

Thinking about this some more, I wonder if it would be better to have add_bounce_page() do coalescing in much the same way as _bus_dmamap_addseg() already does. You'd still have the 2-page array in struct bounce_page, but add_bounce_page() would go back to just taking one address. It would look at the tail of map->bpages (if that exists). If that last bounce page can still fit the new segment with the right alignment, then its datacount will be increased and datapage[1] will be set if necessary. Otherwise, a new bounce page will be pulled from the bz queue.

Oct 13 2015, 11:01 PM
jah updated the diff for D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.

Port unmapped bounce buffer alignment fix from x86

Oct 13 2015, 11:45 AM
jah updated the diff for D3870: Use pmap_quick* in arm64 busdma.

Port unmapped bounce buffer alignment fix from x86

Oct 13 2015, 11:43 AM
jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.

Port unmapped bounce buffer alignment fix from x86

Oct 13 2015, 11:42 AM
jah committed rS289202: Ensure the client regions for unmapped bounce buffers created through….
Ensure the client regions for unmapped bounce buffers created through…
Oct 13 2015, 2:18 AM

Oct 12 2015

jah accepted D888: x86/dma_bounce: rework _bus_dmamap_load_ma implementation.
Oct 12 2015, 10:43 PM
jah added a comment to D888: x86/dma_bounce: rework _bus_dmamap_load_ma implementation.

I like the memdesc idea, or at least something like it. I also agree that it's too tall an order to do everywhere right now, especially if Xen needs this right away.

Oct 12 2015, 10:42 PM

Oct 11 2015

jah updated D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.
Oct 11 2015, 9:44 PM
jah added reviewers for D3870: Use pmap_quick* in arm64 busdma: andrew, emaste.
Oct 11 2015, 9:35 PM
jah retitled D3870: Use pmap_quick* in arm64 busdma from to Use pmap_quick* in arm64 busdma.
Oct 11 2015, 9:34 PM
jah added reviewers for D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers: loos, ian.
Oct 11 2015, 9:30 PM
jah retitled D3869: Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers from to Update armv6 busdma implementation to support unmapped/out-of-context userspace buffers.
Oct 11 2015, 9:27 PM
jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.

Adding assert on non-contiguous pages

Oct 11 2015, 5:55 PM

Oct 1 2015

jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.
  • Simplify loop in sync_sl
Oct 1 2015, 4:56 PM
jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.
  • Fix logic errors around call to sync_buf and bounce buffer cache maintenance
  • Remove sync_buf call for unmapped case: cache operations in pmap_quick_enter_page()->pmap_kenter()->pmap_fix_cache() make sync_buf irrelevant
Oct 1 2015, 4:25 PM

Sep 16 2015

jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.

Style fixes. Initialize sl outside the mapping loop, since it is incremented inside the loop.

Sep 16 2015, 3:54 PM

Sep 1 2015

jah updated the diff for D3522: Use pmap_quick* in pre-v6 arm busdma implementation.

Making sl coalescing logic a little clearer, preventing coalescing in the case where the sl has a non-contiguous KVA but the physical pages happen to be adjacent.

Sep 1 2015, 3:59 AM

Aug 28 2015

jah added reviewers for D3522: Use pmap_quick* in pre-v6 arm busdma implementation: ian, kib.
Aug 28 2015, 4:58 PM
jah retitled D3522: Use pmap_quick* in pre-v6 arm busdma implementation from to Use pmap_quick* in pre-v6 arm busdma implementation.
Aug 28 2015, 4:56 PM

Aug 17 2015

jah committed rS286851: Some cleanups to make the style of pmap_quick_enter_page() and….
Some cleanups to make the style of pmap_quick_enter_page() and…
Aug 17 2015, 6:28 PM

Aug 14 2015

jah committed rS286787: Use pmap_quick_enter_page() to handle bouncing of unmapped buffers in the x86….
Use pmap_quick_enter_page() to handle bouncing of unmapped buffers in the x86…
Aug 14 2015, 8:08 PM
jah committed rS286785: Reformat x86 bounce buffer synchronization code to reduce indentation. No….
Reformat x86 bounce buffer synchronization code to reduce indentation. No…
Aug 14 2015, 6:01 PM

Aug 7 2015

jah committed rS286411: Create man page for pmap_quick_enter_page(9) and pmap_quick_remove_page(9).
Create man page for pmap_quick_enter_page(9) and pmap_quick_remove_page(9)
Aug 7 2015, 12:13 PM
jah closed D3312: pmap_quick_enter_page.9 by committing rS286411: Create man page for pmap_quick_enter_page(9) and pmap_quick_remove_page(9).
Aug 7 2015, 12:13 PM

Aug 6 2015

jah updated the diff for D3312: pmap_quick_enter_page.9.

Fix problems noted by wblock

Aug 6 2015, 8:40 PM
jah updated the diff for D3312: pmap_quick_enter_page.9.

Fix lint warnings

Aug 6 2015, 3:48 PM
jah updated the diff for D3312: pmap_quick_enter_page.9.

Move each sentence to its own line

Aug 6 2015, 3:38 PM
jah updated the diff for D3312: pmap_quick_enter_page.9.

Fixing the bugs kib pointed out

Aug 6 2015, 2:56 PM
jah added reviewers for D3312: pmap_quick_enter_page.9: kib, wblock.
Aug 6 2015, 2:43 AM
jah retitled D3312: pmap_quick_enter_page.9 from to pmap_quick_enter_page.9.
Aug 6 2015, 2:41 AM

Aug 5 2015

jah committed rS286313: Properly sort the function declarations added in r286296.
Properly sort the function declarations added in r286296
Aug 5 2015, 10:48 AM

Aug 4 2015

jah committed rS286296: Add two new pmap functions:.
Add two new pmap functions:
Aug 4 2015, 7:46 PM
jah closed D3013: KPI for quick single-page mappings by committing rS286296: Add two new pmap functions:.
Aug 4 2015, 7:46 PM

Jul 7 2015

jah retitled D3014: Rough kmod for testing pmap_quick_enter_page/pmap_quick_remove_page from to Rough kmod for testing pmap_quick_enter_page/pmap_quick_remove_page.
Jul 7 2015, 4:12 PM
jah retitled D3013: KPI for quick single-page mappings from to KPI for quick single-page mappings.
Jul 7 2015, 4:10 PM

Jun 13 2015

jah added inline comments to D2744: Protect smbus ioctls in ig4 driver using a shared lock.
Jun 13 2015, 3:28 AM
jah added a comment to D2744: Protect smbus ioctls in ig4 driver using a shared lock.

I think it is possible for calls into the smbus interface to get interleaved right now. If they come from smb(4) ioctls, they could get interleaved because that driver does not hold its own sx like iic(4) does (and did even before r281828). But those calls could also be made by another driver directly calling something like smbus_bwrite(), without going through smb(4).

Jun 13 2015, 3:25 AM

May 15 2015

jah committed rS282969: Bump date for iic.4.
Bump date for iic.4
May 15 2015, 1:04 PM
jah committed rS282966: Update iic(4) man page to reflect recent changes.
Update iic(4) man page to reflect recent changes
May 15 2015, 12:28 PM
jah closed D2461: Update iic(4) man page to reflect recent changes by committing rS282966: Update iic(4) man page to reflect recent changes.
May 15 2015, 12:28 PM

May 6 2015

jah updated the diff for D2461: Update iic(4) man page to reflect recent changes.

Addressing wblock's feedback

May 6 2015, 7:38 PM
jah added reviewers for D2461: Update iic(4) man page to reflect recent changes: imp, wblock.
May 6 2015, 3:17 PM
jah retitled D2461: Update iic(4) man page to reflect recent changes from to Update iic(4) man page to reflect recent changes.
May 6 2015, 3:16 PM

Apr 21 2015

jah closed D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

Closed by commit rS281828 (authored by @jah).

Apr 21 2015, 11:50 AM

Apr 15 2015

jah added a comment to D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

@imp, @loos: can you guys look over this again as soon as you get a chance and see if you find it acceptable from an iic perspective?

Apr 15 2015, 6:34 PM

Apr 6 2015

jah updated the diff for D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

addressing jhb's feedback:

  • looping on short writes
  • always using M_WAITOK
  • style(9) fixes
Apr 6 2015, 11:56 PM
jah added a reviewer for D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus(): jhb.
Apr 6 2015, 9:20 PM
jah added a comment to D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().
Apr 6 2015, 8:53 PM

Apr 3 2015

jah added a comment to D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

imp, loos: can you guys look over this again when you have time?
I also need some clarification on Warner's comment about the lock.

Apr 3 2015, 3:13 PM
jah updated the diff for D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

Change chunk size back to 128 bytes. That should still be OK to keep on the kernel stack. 32 might be too stingy for faster iic controllers.

Apr 3 2015, 3:09 PM

Mar 27 2015

jah updated the diff for D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

--Shrink chunk size to 32 bytes (same as smbus blocksize), move buffer to stack
--Respect O_NONBLOCK for mallocs
--Document IICBUS_CALLBACK locking assumptions in iiconf.c and iicbus interface

Mar 27 2015, 12:27 PM

Mar 26 2015

jah added reviewers for D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus(): imp, loos.
Mar 26 2015, 10:07 PM
jah added inline comments to D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().
Mar 26 2015, 4:28 PM
jah updated the diff for D2140: Attempt to fix race conditions and improve flexibility of iic(4), fix locking in iicbus_request_bus() and iicbus_release_bus().

Remove stale comment

Mar 26 2015, 1:58 PM