]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
10 years agodrm/ttm: Fix style in ttm_bo_release_mmap()
dumbbell [Sun, 25 Aug 2013 15:26:45 +0000 (15:26 +0000)]
drm/ttm: Fix style in ttm_bo_release_mmap()

10 years agodrm/ttm: Fix unmap of buffer object
dumbbell [Sun, 25 Aug 2013 15:15:55 +0000 (15:15 +0000)]
drm/ttm: Fix unmap of buffer object

Add a new ttm_bo_release_mmap() function to unmap pages in a
vm_object_t. Pages are freed when the buffer object is later released.

This function is called in ttm_bo_unmap_virtual_locked(), replacing
Linux' unmap_mapping_range(). In particular this is called when a buffer
object is about to be moved, so that its mapping is invalidated.

However, we don't use this function in ttm_bo_vm_dtor(), because the
vm_object_t is already marked as OBJ_DEAD and the pages will be
unmapped.

Approved by: kib@

10 years agottm: "to_page->valid = VM_PAGE_BITS_ALL" before vm_page_dirty(to_page)
dumbbell [Sun, 25 Aug 2013 15:12:26 +0000 (15:12 +0000)]
ttm: "to_page->valid = VM_PAGE_BITS_ALL" before vm_page_dirty(to_page)

Approved by; kib@

10 years agodrm/ttm: Improve comment in ttm_bo_vm_ctor() about lack of ref acquisition
dumbbell [Sun, 25 Aug 2013 15:06:48 +0000 (15:06 +0000)]
drm/ttm: Improve comment in ttm_bo_vm_ctor() about lack of ref acquisition

Approved by: kib@

10 years agodrm/ttm: When removing a range of pages from a pool, remove all of them
dumbbell [Sun, 25 Aug 2013 15:05:22 +0000 (15:05 +0000)]
drm/ttm: When removing a range of pages from a pool, remove all of them

Submitted by: Mark Kettenis and Jonathan Gray from OpenBSD
Approved by: kib@

10 years agodrm/ttm: Fix style errors
dumbbell [Sun, 25 Aug 2013 15:01:35 +0000 (15:01 +0000)]
drm/ttm: Fix style errors

10 years agodrm/ttm: Make ttm_bo_wait() call uninterruptible in page fault handler
dumbbell [Sun, 25 Aug 2013 15:00:48 +0000 (15:00 +0000)]
drm/ttm: Make ttm_bo_wait() call uninterruptible in page fault handler

This fixes a crash where a SIGLALRM, heavily used by X.Org, would
interrupt the wait, causing the page fault to fail and the "Xorg"
process to receive a SIGSEGV.

Approved by: kib@

10 years agodrm/ttm: Import Linux commit ff7c60c580d9722f820d85c9c58ca55ecc1ee7c4
dumbbell [Sun, 25 Aug 2013 14:58:44 +0000 (14:58 +0000)]
drm/ttm: Import Linux commit ff7c60c580d9722f820d85c9c58ca55ecc1ee7c4

Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Jan 14 15:08:14 2013 +0100

    drm/ttm: fix fence locking in ttm_buffer_object_transfer, 2nd try

    This fixes up

    commit e8e89622ed361c46bf90ba4828e685a8b603f7e5
    Author: Daniel Vetter <daniel.vetter@ffwll.ch>
    Date:   Tue Dec 18 22:25:11 2012 +0100

        drm/ttm: fix fence locking in ttm_buffer_object_transfer

    which leaves behind a might_sleep in atomic context, since the
    fence_lock spinlock is held over a kmalloc(GFP_KERNEL) call. The fix
    is to revert the above commit and only take the lock where we need it,
    around the call to ->sync_obj_ref.

    v2: Fixup things noticed by Maarten Lankhorst:
    - Brown paper bag locking bug.
    - No need for kzalloc if we clear the entire thing on the next line.
    - check for bo->sync_obj (totally unlikely race, but still someone
      else could have snuck in) and clear fbo->sync_obj if it's cleared
      already.

Reported-by: Dave Airlie <airlied@gmail.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Approved by: kib@

10 years agodrm/ttm: Import Linux commit 014b34409fb2015f63663b6cafdf557fdf289628
dumbbell [Sun, 25 Aug 2013 14:56:14 +0000 (14:56 +0000)]
drm/ttm: Import Linux commit 014b34409fb2015f63663b6cafdf557fdf289628

Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Jan 16 15:58:34 2013 +1000

    ttm: on move memory failure don't leave a node dangling

    if we have a move notify callback, when moving fails, we call move notify
    the opposite way around, however this ends up with *mem containing the mm_node
    from the bo, which means we double free it. This is a follow on to the previous
    fix.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Approved by: kib@

10 years agodrm/ttm: Import Linux commit 630541863b29f88c7ab34e647758344e4cd1eafd
dumbbell [Sun, 25 Aug 2013 14:55:08 +0000 (14:55 +0000)]
drm/ttm: Import Linux commit 630541863b29f88c7ab34e647758344e4cd1eafd

Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Jan 16 14:25:44 2013 +1000

    ttm: don't destroy old mm_node on memcpy failure

    When we are using memcpy to move objects around, and we fail to memcpy
    due to lack of memory to populate or failure to finish the copy, we don't
    want to destroy the mm_node that has been copied into old_copy.

    While working on a new kms driver that uses memcpy, if I overallocated bo's
    up to the memory limits, and eviction failed, then machine would oops soon
    after due to having an active bo with an already freed drm_mm embedded in it,
    freeing it a second time didn't end well.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Approved by: kib@

10 years agodrm/ttm: Import Linux commit cc4c0c4de3c775be22072ec3251f2e581b63d9a0
dumbbell [Sun, 25 Aug 2013 14:53:39 +0000 (14:53 +0000)]
drm/ttm: Import Linux commit cc4c0c4de3c775be22072ec3251f2e581b63d9a0

Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:57:28 2013 +0100

    drm/ttm: unexport ttm_bo_wait_unreserved

    All legitimate users of this function outside ttm_bo.c are gone, now
    it's only an implementation detail.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Approved by: kib@

10 years agodrm/ttm: Import Linux commit f2d476a110bc24fde008698ae9018c99e803e25c
dumbbell [Sun, 25 Aug 2013 14:52:20 +0000 (14:52 +0000)]
drm/ttm: Import Linux commit f2d476a110bc24fde008698ae9018c99e803e25c

Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:57:10 2013 +0100

    drm/ttm: use ttm_bo_reserve_slowpath_nolru in ttm_eu_reserve_buffers, v2

    This requires re-use of the seqno, which increases fairness slightly.
    Instead of spinning with a new seqno every time we keep the current one,
    but still drop all other reservations we hold. Only when we succeed,
    we try to get back our other reservations again.

    This should increase fairness slightly as well.

    Changes since v1:
     - Increase val_seq before calling ttm_bo_reserve_slowpath_nolru and
       retrying to take all entries to prevent a race.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Approved by: kib@

10 years agodrm/ttm: Import Linux commit 5e45d7dfd74100d622f9cdc70bfd1f9fae1671de
dumbbell [Sun, 25 Aug 2013 14:47:22 +0000 (14:47 +0000)]
drm/ttm: Import Linux commit 5e45d7dfd74100d622f9cdc70bfd1f9fae1671de

Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:57:05 2013 +0100

    drm/ttm: add ttm_bo_reserve_slowpath

    Instead of dropping everything, waiting for the bo to be unreserved
    and trying over, a better strategy would be to do a blocking wait.

    This can be mapped a lot better to a mutex_lock-like call.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Approved by: kib@

10 years agodrm/ttm: Import Linux commit 7a1863084c9d90ce4b67d645bf9b0f1612e68f62
dumbbell [Sun, 25 Aug 2013 14:41:22 +0000 (14:41 +0000)]
drm/ttm: Import Linux commit 7a1863084c9d90ce4b67d645bf9b0f1612e68f62

Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:56:48 2013 +0100

    drm/ttm: cleanup ttm_eu_reserve_buffers handling

    With the lru lock no longer required for protecting reservations we
    can just do a ttm_bo_reserve_nolru on -EBUSY, and handle all errors
    in a single path.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
10 years agodrm/ttm: Import Linux commit 63d0a4195560362e2e00a3ad38fc331d34e1da9b
dumbbell [Sun, 25 Aug 2013 14:39:51 +0000 (14:39 +0000)]
drm/ttm: Import Linux commit 63d0a4195560362e2e00a3ad38fc331d34e1da9b

Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:56:37 2013 +0100

    drm/ttm: remove lru_lock around ttm_bo_reserve

    There should no longer be assumptions that reserve will always succeed
    with the lru lock held, so we can safely break the whole atomic
    reserve/lru thing. As a bonus this fixes most lockdep annotations for
    reservations.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
10 years agodrm: Update drm_atomic.h, now that projects/atomic64 is in HEAD
dumbbell [Sun, 25 Aug 2013 14:33:49 +0000 (14:33 +0000)]
drm: Update drm_atomic.h, now that projects/atomic64 is in HEAD

Submitted by: jkim@

10 years agodrm: Add missing bits to drmP.h, required by the Radeon driver
dumbbell [Sun, 25 Aug 2013 14:27:14 +0000 (14:27 +0000)]
drm: Add missing bits to drmP.h, required by the Radeon driver

Some of the FreeBSD-specific definitions are moved to drm_os_freebsd.h.
But there's still work to do to clean it up and reduce the diff with
Linux' drmP.h.

10 years agoFix CSUM compatibility mapping. SCTP is a layer 4 protocol.
andre [Sun, 25 Aug 2013 13:30:37 +0000 (13:30 +0000)]
Fix CSUM compatibility mapping.  SCTP is a layer 4 protocol.

Submitted by: tuexen

10 years agoUpdate the mis-predicted branch PMC names (for sandy bridge) to not clash.
adrian [Sun, 25 Aug 2013 12:58:34 +0000 (12:58 +0000)]
Update the mis-predicted branch PMC names (for sandy bridge) to not clash.

The SDM (June 2013) tables on these are rather confusing.  Yes, they
assign the same name (BR_MISP_RETIRED.ALL_BRANCHES) to two codes
(C5H/00H and C5H/04H.) The latter however is the PEBS version.

So, to make it easier to see the difference - and yes, we can use
both without having to actually enable the PEBS specific bits! -
just rename the PEBS one to _PS so there's no clashing.

Tested:

* Sandy bridge

10 years agoProvide human readable debug output.
tuexen [Sun, 25 Aug 2013 12:44:03 +0000 (12:44 +0000)]
Provide human readable debug output.

10 years agodrm: Import drm_fixed.h from Linux 3.8
dumbbell [Sun, 25 Aug 2013 12:27:15 +0000 (12:27 +0000)]
drm: Import drm_fixed.h from Linux 3.8

10 years agodrm: Update drm_pciids.h based on Linux 3.8
dumbbell [Sun, 25 Aug 2013 12:20:57 +0000 (12:20 +0000)]
drm: Update drm_pciids.h based on Linux 3.8

This header can be easily updated using the new "gen-drm_pciids" script,
available in tools/tools/drm. The script uses the Linux' drm_pciids.h
header for new IDs, the FreeBSD's one because we add the name of the
device to each IDs, and the PCI IDs database (misc/pciids port) to fill
this name automatically for new IDS.

To call the script:
  tools/tools/drm/gen-drm_pciids \
    /path/to/linux/drm_pciids.h \
    /path/to/freebsd/drm_pciids.h \
    /path/to/pciids/pci.ids

10 years agoDisable lldb target support not (currently) of interest
emaste [Sun, 25 Aug 2013 12:07:34 +0000 (12:07 +0000)]
Disable lldb target support not (currently) of interest

- Remote iOS debugging
- OS X symbol provider, core files
- PECOFF object files
- Linux platform support

Sponsored by: DARPA, AFRL

10 years agoFix a >80 character long line, introduced in my previous commit.
adrian [Sun, 25 Aug 2013 12:02:20 +0000 (12:02 +0000)]
Fix a >80 character long line, introduced in my previous commit.

Noticed by: hiren

10 years agosh: Recognize "--" as end of options in alias builtin.
jilles [Sun, 25 Aug 2013 11:42:53 +0000 (11:42 +0000)]
sh: Recognize "--" as end of options in alias builtin.

Aliases starting with "-" (which are non-POSIX) will need to be preceded by
an alias not starting with "-" or the newly added "--".

10 years agodrm: Import drm_pcie_get_speed_cap_mask() in drm_pci.c
dumbbell [Sun, 25 Aug 2013 11:34:37 +0000 (11:34 +0000)]
drm: Import drm_pcie_get_speed_cap_mask() in drm_pci.c

This comes with several PCI_VENDOR_ID_* defines which should go in a
more central place.

10 years agoAdd the frame information to cpu_switch to allow us to unwind out of it,
andrew [Sun, 25 Aug 2013 11:23:38 +0000 (11:23 +0000)]
Add the frame information to cpu_switch to allow us to unwind out of it,
for example when dumping threads in the kernel debugger.

10 years agoAdd the unwind information to irq_entry so we can pass through it when
andrew [Sun, 25 Aug 2013 11:21:03 +0000 (11:21 +0000)]
Add the unwind information to irq_entry so we can pass through it when
unwinding the stack.

10 years agoBump FreeBSD_version after the struct mbuf changes in r254780,
andre [Sun, 25 Aug 2013 11:01:18 +0000 (11:01 +0000)]
Bump FreeBSD_version after the struct mbuf changes in r254780,
r254799, r254804, r254807, and r254842.

Sponsored by: The FreeBSD Foundation

10 years agosh: Disallow empty simple commands.
jilles [Sun, 25 Aug 2013 10:57:48 +0000 (10:57 +0000)]
sh: Disallow empty simple commands.

As per POSIX, a simple command must have at least one redirection,
assignment word or command word.

These occured in rare cases such as  eval "f()" .

The extension of allowing no commands inside { }, if, while, for, etc.
remains.

10 years agoGive (*ext_free) an int return value allowing for very sophisticated
andre [Sun, 25 Aug 2013 10:57:09 +0000 (10:57 +0000)]
Give (*ext_free) an int return value allowing for very sophisticated
external mbuf buffer management capabilities in the future.

For now only EXT_FREE_OK is defined with current legacy behavior.

Sponsored by: The FreeBSD Foundation

10 years agodrm: Import list_for_each_entry_safe_from() macro
dumbbell [Sun, 25 Aug 2013 10:28:02 +0000 (10:28 +0000)]
drm: Import list_for_each_entry_safe_from() macro

10 years agodrm: Use DRM_IF_MAJOR & DRM_IF_MINOR from drm_core.h
dumbbell [Sun, 25 Aug 2013 10:13:23 +0000 (10:13 +0000)]
drm: Use DRM_IF_MAJOR & DRM_IF_MINOR from drm_core.h

10 years agodrm: In drm_gem_name_create(), verify argument before acquiring lock
dumbbell [Sun, 25 Aug 2013 10:04:10 +0000 (10:04 +0000)]
drm: In drm_gem_name_create(), verify argument before acquiring lock

Submitted by: J.R. Oldroyd <jr@opal.com>

10 years agodrm: Call "gem_close_object" driver callback from drm_gem_object_release_handle()
dumbbell [Sun, 25 Aug 2013 10:01:59 +0000 (10:01 +0000)]
drm: Call "gem_close_object" driver callback from drm_gem_object_release_handle()

This fixes leakage of "bo_va" for Cayman and following card generations.

10 years agodrm: Support gem_open_object() and gem_close_object() callbacks
dumbbell [Sun, 25 Aug 2013 09:58:31 +0000 (09:58 +0000)]
drm: Support gem_open_object() and gem_close_object() callbacks

... in struct drm_driver_info.

10 years agodrm: Fix typo in KASSERT message: s/Dandling/Dangling/
dumbbell [Sun, 25 Aug 2013 09:53:00 +0000 (09:53 +0000)]
drm: Fix typo in KASSERT message: s/Dandling/Dangling/

10 years agoFor now limit printf(9) %x of the 64bit pkthdr.csum_flags field to 32bits.
andre [Sun, 25 Aug 2013 09:49:00 +0000 (09:49 +0000)]
For now limit printf(9) %x of the 64bit pkthdr.csum_flags field to 32bits.
The upper 32bits are not occupied for now.

Sponsored by: The FreeBSD Foundation

10 years agodrm: Import Linux commit cd004b3f4cd4169815c82bf9e424fda06978898a
dumbbell [Sun, 25 Aug 2013 09:46:03 +0000 (09:46 +0000)]
drm: Import Linux commit cd004b3f4cd4169815c82bf9e424fda06978898a

Author: Shirish S <s.shirish@samsung.com>
Date:   Thu Aug 30 07:04:06 2012 +0000

    drm: edid: add support for E-DDC

    The current logic for probing ddc is limited to
    2 blocks (256 bytes), this patch adds support
    for the 4 block (512) data.

    To do this, a single 8-bit segment index is
    passed to the display via the I2C address 30h.
    Data from the selected segment is then immediately
    read via the regular DDC2 address using a repeated
    I2C 'START' signal.

Signed-off-by: Shirish S <s.shirish@samsung.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoChange m->pkthdr.header to m->pkthdr.PH_loc.ptr after r254804
andre [Sun, 25 Aug 2013 09:45:26 +0000 (09:45 +0000)]
Change m->pkthdr.header to m->pkthdr.PH_loc.ptr after r254804
to transiently store pointers to packet headers.

Sponsored by: The FreeBSD Foundation

10 years agoRemove unnecessary setup of the m->pkthdr.header pointer.
andre [Sun, 25 Aug 2013 09:41:37 +0000 (09:41 +0000)]
Remove unnecessary setup of the m->pkthdr.header pointer.

Sponsored by: The FreeBSD Foundation

10 years agoAdjust socow_iodone() after r254799.
andre [Sun, 25 Aug 2013 09:40:15 +0000 (09:40 +0000)]
Adjust socow_iodone() after r254799.

Sponsored by: The FreeBSD Foundation

10 years agoExport a PERIODIC environment variable from periodic(8). This will
jlh [Sun, 25 Aug 2013 08:56:09 +0000 (08:56 +0000)]
Export a PERIODIC environment variable from periodic(8).  This will
allow periodic security scripts to know if they have been called in
a daily or a weekly context.

10 years agoBugfix: The endpoint profile should only be checked in device mode when
hselasky [Sun, 25 Aug 2013 08:42:50 +0000 (08:42 +0000)]
Bugfix: The endpoint profile should only be checked in device mode when
allocating USB transfers and not in host mode.

Reported by: George Mitchell <george+freebsd@m5p.com>

10 years agoMove daily_status_security_noamd next to 200.chkmounts's variables.
jlh [Sun, 25 Aug 2013 07:46:18 +0000 (07:46 +0000)]
Move daily_status_security_noamd next to 200.chkmounts's variables.

10 years agoRemove EOL whitespace.
joel [Sun, 25 Aug 2013 06:59:30 +0000 (06:59 +0000)]
Remove EOL whitespace.

10 years agomdoc fixes.
joel [Sun, 25 Aug 2013 06:58:51 +0000 (06:58 +0000)]
mdoc fixes.

10 years agoUpdate the MEM_UOP_RETIRED PMC operation for sandy bridge and sandy
adrian [Sun, 25 Aug 2013 02:07:28 +0000 (02:07 +0000)]
Update the MEM_UOP_RETIRED PMC operation for sandy bridge and sandy
bridge Xeon.

Summary: These are PEBS events but they're also available as normal
counter/sample events.  The source table (Table 19-2) lists the
base versions (LOAD, STLB_MISS, SPLIT, ALL) but it says they must
be qualified with other values.  This particular commit fleshes
out those umask values.

Source:

* Linux; SDM June 2013, Volume 3B, Table 19-2 and 18-21.

Tested:

* Sandy Bridge (non-Xeon)

10 years agoRemove the #ifdef OFED from the 20 byte mac in struct llentry.
alfred [Sun, 25 Aug 2013 01:55:14 +0000 (01:55 +0000)]
Remove the #ifdef OFED from the 20 byte mac in struct llentry.

With this change it is now possible to build the entire infiniband
stack as modules and load it dynamically including IP over IB.

10 years agodrm: In drm_mmap_single, try ttm_bo_mmap_single() before drm_gem_mmap_single()
dumbbell [Sun, 25 Aug 2013 00:34:44 +0000 (00:34 +0000)]
drm: In drm_mmap_single, try ttm_bo_mmap_single() before drm_gem_mmap_single()

In drivers such as the Radeon driver, the DRIVER_GEM features flag is
set but TTM is used to mmap buffer object.

10 years agodrm: Fix cleanup if device initialization fails
dumbbell [Sun, 25 Aug 2013 00:22:34 +0000 (00:22 +0000)]
drm: Fix cleanup if device initialization fails

This plugs some memory leaks.

10 years agodrm: Use driver-provided "use_msi" callback to determine if MSI is blacklisted
dumbbell [Sun, 25 Aug 2013 00:13:53 +0000 (00:13 +0000)]
drm: Use driver-provided "use_msi" callback to determine if MSI is blacklisted

For now, keep the static array for i915. But eventually, it should be
moved to a callback in the driver itself.

10 years agodrm: Don't delete already deleted iicbus child from drm_iic_dp_aux
dumbbell [Sat, 24 Aug 2013 23:54:06 +0000 (23:54 +0000)]
drm: Don't delete already deleted iicbus child from drm_iic_dp_aux

The iic_dp_aux_detach callback is therefore useless: it's replaced by
bus_generic_detach. This fixes a "General protection fault" panic during
second (incorrect) deletion of the child.

Tested by: kwm@
Reviewed by: ray@

10 years agodrm: Move definition of EREMOTEIO to drmP.h
dumbbell [Sat, 24 Aug 2013 23:47:31 +0000 (23:47 +0000)]
drm: Move definition of EREMOTEIO to drmP.h

It will be used by both i915 and radeon drivers.

Add ERESTARTSYS definition at the same time.

10 years agodrm: Import drm_dp_helper.c from Linux 3.8-rc3
dumbbell [Sat, 24 Aug 2013 23:38:57 +0000 (23:38 +0000)]
drm: Import drm_dp_helper.c from Linux 3.8-rc3

While here, update drm_dp_helper.h to better match Linux one.

10 years agoFix BUGS section after botched modify in r254772.
andre [Sat, 24 Aug 2013 21:30:35 +0000 (21:30 +0000)]
Fix BUGS section after botched modify in r254772.

Reported by: bjk

10 years agoAfter r254779 "error" must always be present in mb_ctor_pack(),
andre [Sat, 24 Aug 2013 21:25:53 +0000 (21:25 +0000)]
After r254779 "error" must always be present in mb_ctor_pack(),
not only when MAC is defined.

Reported by: gjb / tinderbox
Sponsored by: The FreeBSD Foundation

10 years agoRename the kld_unload event handler to kld_unload_try, and add a new
markj [Sat, 24 Aug 2013 21:13:38 +0000 (21:13 +0000)]
Rename the kld_unload event handler to kld_unload_try, and add a new
kld_unload event handler which gets invoked after a linker file has been
successfully unloaded. The kld_unload and kld_load event handlers are now
invoked with the shared linker lock held, while kld_unload_try is invoked
with the lock exclusively held.

Convert hwpmc(4) to use these event handlers instead of having
kern_kldload() and kern_kldunload() invoke hwpmc(4) hooks whenever files are
loaded or unloaded. This has no functional effect, but simplifes the linker
code somewhat.

Reviewed by: jhb

10 years agoRemove unused m_free_fast(). The difference to m_free() is only
andre [Sat, 24 Aug 2013 21:09:57 +0000 (21:09 +0000)]
Remove unused m_free_fast().  The difference to m_free() is only
2 predictable branches nowadays.  However as a pre-condition the
caller had to ensure that the mbuf pkthdr did not have any mtags
attached to it, costing some potential branches again.

Sponsored by: The FreeBSD Foundation

10 years agoSet things up so that linker_file_lookup_set() is always called with the
markj [Sat, 24 Aug 2013 21:08:55 +0000 (21:08 +0000)]
Set things up so that linker_file_lookup_set() is always called with the
linker lock held. This makes it possible to call it from a kld event handler
with the shared lock held.

Reviewed by: jhb

10 years agoRemove the kld lock macros and just use the sx(9) API. Add locking in
markj [Sat, 24 Aug 2013 21:07:04 +0000 (21:07 +0000)]
Remove the kld lock macros and just use the sx(9) API. Add locking in
linker_init_kernel_modules() and linker_preload() in order to remove most
of the checks for !cold before asserting that the kld lock is held. These
routines are invoked by SYSINIT(9), so there's no harm in them taking the
kld lock.

10 years agoDo not use "Enable Implied Seek" on enhanced floppy controllers. This
joerg [Sat, 24 Aug 2013 21:04:54 +0000 (21:04 +0000)]
Do not use "Enable Implied Seek" on enhanced floppy controllers.  This
breaks the "2step" feature of the driver, e.g. in order to read 360
KiB media on a 1200 KiB drive.

As the only potential advantage of implied (vs. explicit) seeks is to
minimize the software effort, yet our driver always contained the
logic needed for explicit seeks, simply dropping implied seeks is the
best solution without introducing risks for new bugs.  There is no
performance penalty, reading a 1440 KiB medium takes exactly the same
time with both, implied or explicit seeks.

MFC after: 1 week

10 years agoRemove some code that has been commented out since it was added in 2000.
markj [Sat, 24 Aug 2013 21:00:39 +0000 (21:00 +0000)]
Remove some code that has been commented out since it was added in 2000.

10 years agoCompact m_hdr by packing the type and flags fields into one uint32_t.
andre [Sat, 24 Aug 2013 20:26:41 +0000 (20:26 +0000)]
Compact m_hdr by packing the type and flags fields into one uint32_t.

The mbuf type is an enumerator with only a handful of types in use and
thus reduced from int to 8bits allowing for 255 types to be specified.
Only 5 types have been in use for a long time.

The flags field gets the remaining 24 bits with 12 bits for global
persistent flags and 12 bits for protocol/layer specific overlays.
Some of the global flags/functionality can be moved to the csum_flags
or ext_flags bits in the future.

MT_VENDOR[1-4] and MT_EXP[1-4] types for vendor-internal and
experimental local mapping are added.

The size of m_hdr shrinks from 24/40 to 20/32bytes (32/64bit architectures).

Sponsored by: The FreeBSD Foundation

10 years agosh: Reject ++ and -- in arithmetic.
jilles [Sat, 24 Aug 2013 20:06:00 +0000 (20:06 +0000)]
sh: Reject ++ and -- in arithmetic.

POSIX does not require ++ and -- in arithmetic. It is probably more useful
to reject them than to treat ++x and --x as x silently.

Note that the behaviour of increment and decrement can be obtained via
(x+=1), ((x+=1)-1), (x-=1) and ((x-=1)+1).

PR: bin/176444

10 years agoAdd mtodo(m, o) macro taking an additional offset into the mbuf data section.
andre [Sat, 24 Aug 2013 19:58:36 +0000 (19:58 +0000)]
Add mtodo(m, o) macro taking an additional offset into the mbuf data section.

Sponsored by: The FreeBSD Foundation

10 years agoRestructure the mbuf pkthdr to make it fit for upcoming capabilities and
andre [Sat, 24 Aug 2013 19:51:18 +0000 (19:51 +0000)]
Restructure the mbuf pkthdr to make it fit for upcoming capabilities and
features.  The changes in particular are:

o Remove rarely used "header" pointer and replace it with a 64bit protocol/
  layer specific union PH_loc for local use.  Protocols can flexibly overlay
  their own 8 to 64 bit fields to store information while the packet is
  worked on.

o Mechanically convert IP reassembly, IGMP/MLD and ATM to use pkthdr.PH_loc
  instead of pkthdr.header.

o Extend csum_flags to 64bits to allow for additional future offload
  information to be carried (e.g. iSCSI, IPsec offload, and others).

o Move the RSS hash type enumerator from abusing m_flags to its own 8bit
  rsstype field.  Adjust accessor macros.

o Add cosqos field to store Class of Service / Quality of Service information
  with the packet.  It is not yet supported in any drivers but allows us to
  get on par with Cisco/Juniper in routing applications (plus MPLS QoS) with
  a modernized ALTQ.

o Add four 8 bit fields l[2-5]hlen to store the relative header offsets
  from the start of the packet.  This is important for various offload
  capabilities and to relieve the drivers from having to parse the packet
  and protocol headers to find out location of checksums and other
  information.  Header parsing in drivers is a lot of copy-paste and
  unhandled corner cases which we want to avoid.

o Add another flexible 64bit union to map various additional persistent
  packet information, like ether_vtag, tso_segsz and csum fields.
  Depending on the csum_flags settings some fields may have different usage
  making it very flexible and adaptable to future capabilities.

o Restructure the CSUM flags to better signify their outbound (down the
  stack) and inbound (up the stack) use.  The CSUM flags used to be a bit
  chaotic and rather poorly documented leading to incorrect use in many
  places.  Bring clarity into their use through better naming.
  Compatibility mappings are provided to preserve the API.  The drivers
  can be corrected one by one and MFC'd without issue.

o The size of pkthdr stays the same at 48/56bytes (32/64bit architectures).

Sponsored by: The FreeBSD Foundation

10 years agoChange local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts.
andre [Sat, 24 Aug 2013 19:38:36 +0000 (19:38 +0000)]
Change local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts.

Sponsored by: The FreeBSD Foundation

10 years agoFix a printf format warning on 32-bit mips and powerpc.
ken [Sat, 24 Aug 2013 19:02:36 +0000 (19:02 +0000)]
Fix a printf format warning on 32-bit mips and powerpc.

Reported by: bde, gjb
Pointy hat to: ken

10 years agoRemove unnecessary setup of the m->pkthdr.header pointer.
andre [Sat, 24 Aug 2013 17:14:14 +0000 (17:14 +0000)]
Remove unnecessary setup of the m->pkthdr.header pointer.

Sponsored by: The FreeBSD Foundation

10 years agoAdd an mbuf pointer parameter to (*ext_free) to give the external
andre [Sat, 24 Aug 2013 16:57:44 +0000 (16:57 +0000)]
Add an mbuf pointer parameter to (*ext_free) to give the external
free function access to the mbuf the external memory was attached
to.

Mechanically adjust all users to include the mbuf parameter.

This fixes a long standing annoyance for external free functions.
Before one had to sacrifice one of the argument pointers for this.

Sponsored by: The FreeBSD Foundation

10 years agodrm: Fix leak of connector->edid_blob_ptr
dumbbell [Sat, 24 Aug 2013 16:55:53 +0000 (16:55 +0000)]
drm: Fix leak of connector->edid_blob_ptr

10 years agodrm: Const'ify the 1st "drm_display_mode" passed to "mode_fixup" callbacks
dumbbell [Sat, 24 Aug 2013 16:50:47 +0000 (16:50 +0000)]
drm: Const'ify the 1st "drm_display_mode" passed to "mode_fixup" callbacks

This will be needed by the Radeon KMS driver.

10 years agodrm/i915: Import Linux commit 71244653a8fb0f46bc12ae421f1d5f72af6a75da
dumbbell [Sat, 24 Aug 2013 16:41:14 +0000 (16:41 +0000)]
drm/i915: Import Linux commit 71244653a8fb0f46bc12ae421f1d5f72af6a75da

Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Jun 4 18:39:20 2012 +0200

    drm/i915: adjusted_mode->clock in the dp mode_fixup

    ... instead of changing mode->clock, which we should leave as-is.

    After the previous patch we only touch that if it's a panel, and then
    adjusted mode->clock equals adjusted_mode->clock. Outside of
    intel_dp.c we only use ajusted_mode->clock in the mode_set functions.

    Within intel_dp.c we only use it to calculate the dp dithering
    and link bw parameters, so that's the only thing we need to fix
    up.

    As a temporary ugliness (until the cleanup in the next patch) we
    pass the adjusted_mode into dp_dither for both parameters (because
    that one still looks at mode->clock).

    Note that we do overwrite adjusted_mode->clock with the selected dp
    link clock, but that only happens after we've calculated everything we
    need based on the dotclock of the adjusted output configuration.

    Outside of intel_dp.c only intel_display.c uses adjusted_mode->clock,
    and that stays the same after this patch (still equals the selected dp
    link clock). intel_display.c also needs the actual dotclock (as
    target_clock), but that has been fixed up in the previous patch.

    v2: Adjust the debug message to also use adjusted_mode->clock.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Import drm_buffer.[ch] from Linux 3.8-rc3
dumbbell [Sat, 24 Aug 2013 16:14:20 +0000 (16:14 +0000)]
drm: Import drm_buffer.[ch] from Linux 3.8-rc3

This will be used by the Radeon KMS driver.

10 years agoRevert lldb change for Attribute::NoBuiltin
emaste [Sat, 24 Aug 2013 16:09:52 +0000 (16:09 +0000)]
Revert lldb change for Attribute::NoBuiltin

NoBuiltin was introduced after clang/llvm 3.3 and thus does not exist in
FreeBSD.  Thus special handling for the attribute is not needed in lldb.

This reverts lldb r186990 (git eebd175)

Sponsored by: DARPA, AFRL

10 years agodrm: Call drm_global_init() & drm_global_release() at module load/unload
dumbbell [Sat, 24 Aug 2013 15:47:15 +0000 (15:47 +0000)]
drm: Call drm_global_init() & drm_global_release() at module load/unload

10 years agoInclude bsd.own.mk before trying to check MK_* values.
uqs [Sat, 24 Aug 2013 15:41:36 +0000 (15:41 +0000)]
Include bsd.own.mk before trying to check MK_* values.

10 years agoImport llvm r187614 (git 44c8e34), for lldb's use:
emaste [Sat, 24 Aug 2013 15:33:17 +0000 (15:33 +0000)]
Import llvm r187614 (git 44c8e34), for lldb's use:

  Author: Daniel Malea <daniel.malea@intel.com>
  Date:   Thu Aug 1 21:18:16 2013 +0000

    Fixed the Intel-syntax X86 disassembler to respect the (existing)
    option for hexadecimal immediates, to match AT&T syntax. This also
    brings a new option for C-vs-MASM-style hex.

    Patch by Richard Mitton
    Reviewed: http://llvm-reviews.chandlerc.com/D1243

10 years agoMFprojects/camlock r254460:
mav [Sat, 24 Aug 2013 14:41:49 +0000 (14:41 +0000)]
MFprojects/camlock r254460:
Remove locking from taskqueue_member().  The list of threads is static
during the taskqueue life cycle, so there is no need to protect it,
taking quite congested lock several more times for each ZFS I/O.

10 years agoMake dummynet use new direct callout(9) execution mechanism. Since the only
mav [Sat, 24 Aug 2013 13:34:36 +0000 (13:34 +0000)]
Make dummynet use new direct callout(9) execution mechanism.  Since the only
thing done by the dummynet handler is taskqueue_enqueue() call, it doesn't
need extra switch to the clock SWI context.

On idle system this change in half reduces number of active CPU cycles and
wakes up only one CPU from sleep instead of two.

I was going to make this change much earlier as part of calloutng project,
but waited for better solution with skipping idle ticks to be implemented.
Unfortunately with 10.0 release coming it is better get at least this.

10 years agodd a 24 bits wide ext_flags field to m_ext by reducing ext_type
andre [Sat, 24 Aug 2013 13:15:42 +0000 (13:15 +0000)]
dd a 24 bits wide ext_flags field to m_ext by reducing ext_type
to 8 bits.  ext_type is an enumerator and the number of types we
have is a mere dozen.

A couple of ext_types are renumbered to fit within 8 bits.

EXT_VENDOR[1-4] and EXT_EXP[1-4] types for vendor-internal and
experimental local mapping.

The ext_flags field is currently unused but has a couple of flags
already defined for future use.  Again vendor and experimental
flags are provided for local mapping.

EXT_FLAG_BITS is provided for the printf(9) %b identifier.

Initialize and copy ext_flags in the relevant mbuf functions.

Improve alignment and packing of struct m_ext on 32 and 64 archs
by carefully sorting the fields.

10 years agoAvoid code duplication for mbuf initialization and use m_init() instead
andre [Sat, 24 Aug 2013 12:24:58 +0000 (12:24 +0000)]
Avoid code duplication for mbuf initialization and use m_init() instead
in mb_ctor_mbuf() and mb_ctor_pack().

10 years agoWhitespace, style cleanups, and improved comments.
andre [Sat, 24 Aug 2013 12:03:24 +0000 (12:03 +0000)]
Whitespace, style cleanups, and improved comments.

10 years agoMake ipfw nat init/unint work correctly for VIMAGE:
trociny [Sat, 24 Aug 2013 11:59:51 +0000 (11:59 +0000)]
Make ipfw nat init/unint work correctly for VIMAGE:

* Do per vnet instance cleanup (previously it was only for vnet0 on
  module unload, and led to libalias leaks and possible panics due to
  stale pointer dereferences).

* Instead of protecting ipfw hooks registering/deregistering by only
  vnet0 lock (which does not prevent pointers access from another
  vnets), introduce per vnet ipfw_nat_loaded variable. The variable is
  set after hooks are registered and unset before they are deregistered.

* Devirtualize ifaddr_event_tag as we run only one event handler for
  all vnets.

* It is supposed that ifaddr_change event handler is called in the
  interface vnet context, so add an assertion.

Reviewed by: zec
MFC after: 2 weeks

10 years agoAdjust for the pfil_func_t typedef added in r254769.
andre [Sat, 24 Aug 2013 11:57:02 +0000 (11:57 +0000)]
Adjust for the pfil_func_t typedef added in r254769.

10 years agoename PFIL_LIST_[UN]LOCK() to PFIL_HEADLIST_[UN]LOCK() to avoid
andre [Sat, 24 Aug 2013 11:24:15 +0000 (11:24 +0000)]
ename PFIL_LIST_[UN]LOCK() to PFIL_HEADLIST_[UN]LOCK() to avoid
confusion with the pfil_head chain locking macros.

10 years agoResolve the confusion between the head_list and the hook list.
andre [Sat, 24 Aug 2013 11:17:25 +0000 (11:17 +0000)]
Resolve the confusion between the head_list and the hook list.

The linked list of pfil hooks is changed to "chain" and this term
is applied consistently.  The head_list remains with "list" term.

Add KASSERT to vnet_pfil_uninit().

Update and extend comments.

Reviewed by: eri (previous version)

10 years agopfil_hook_get() has been internalized in r254771 and is no longer
andre [Sat, 24 Aug 2013 10:38:02 +0000 (10:38 +0000)]
pfil_hook_get() has been internalized in r254771 and is no longer
part of the API.  It wasn't safe for external use in any case.

10 years agoInternalize pfil_hook_get(). There are no outside consumers of
andre [Sat, 24 Aug 2013 10:36:33 +0000 (10:36 +0000)]
Internalize pfil_hook_get().  There are no outside consumers of
this API, it is only safe for internal use and even the pfil(9)
man page says so in the BUGS section.

Reviewed by: eri

10 years agoConvert one instance of pfil hook callback missed in r254769.
andre [Sat, 24 Aug 2013 10:30:20 +0000 (10:30 +0000)]
Convert one instance of pfil hook callback missed in r254769.

10 years agoIntroduce typedef for pfil hook callback function and replace all
andre [Sat, 24 Aug 2013 10:13:59 +0000 (10:13 +0000)]
Introduce typedef for pfil hook callback function and replace all
spelled out occurrences with it.

Reviewed by: eri

10 years agoRevert lldb changes due to post-3.3 clang and llvm API changes
emaste [Sat, 24 Aug 2013 10:06:51 +0000 (10:06 +0000)]
Revert lldb changes due to post-3.3 clang and llvm API changes

Revisions:
svn git
183929 99447a6
183862 15c1774
  source/Host/common/FileSpec.cpp

184954 007e7bc
184948 4dc3761
  source/Expression/ClangExpressionParser.cpp

182099 b31044e
181387 779e6ac
  include/lldb/Expression/IRExecutionUnit.h
  source/Expression/IRExecutionUnit.cpp

184177 0b2934b
182650 f2dcf35
181703 7bef4e2
  source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp

182683 0d91b80
  source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp

Sponsored by: DARPA, AFRL

10 years agosh: Do not prematurely discard stopped jobs in a wait builtin.
jilles [Sat, 24 Aug 2013 09:57:32 +0000 (09:57 +0000)]
sh: Do not prematurely discard stopped jobs in a wait builtin.

If a job is specified to 'wait', wait for it to complete. Formerly, in
interactive mode, the job was deleted if it stopped.

If no jobs are specified in interactive mode, 'wait' still waits for all jobs
to complete or stop.

In non-interactive mode, WUNTRACED is not passed to wait3() so stopped jobs
are not detected.

PR: bin/181435

10 years agoAdd new attribute lunname to report only textual LUN-specific device IDs.
mav [Sat, 24 Aug 2013 09:42:14 +0000 (09:42 +0000)]
Add new attribute lunname to report only textual LUN-specific device IDs.
While lunid attribute prefers to report numeric ones, having both may be
useful in some situations.

10 years agoAdd support to physio(9) for devices that don't want I/O split and
ken [Sat, 24 Aug 2013 04:52:22 +0000 (04:52 +0000)]
Add support to physio(9) for devices that don't want I/O split and
configure sa(4) to request no I/O splitting by default.

For tape devices, the user needs to be able to clearly understand
what blocksize is actually being used when writing to a tape
device.  The previous behavior of physio(9) was that it would split
up any I/O that was too large for the device, or too large to fit
into MAXPHYS.  This means that if, for instance, the user wrote a
1MB block to a tape device, and MAXPHYS was 128KB, the 1MB write
would be split into 8 128K chunks.  This would be done without
informing the user.

This has suboptimal effects, especially when trying to communicate
status to the user.  In the event of an error writing to a tape
(e.g. physical end of tape) in the middle of a 1MB block that has
been split into 8 pieces, the user could have the first two 128K
pieces written successfully, the third returned with an error, and
the last 5 returned with 0 bytes written.  If the user is using
a standard write(2) system call, all he will see is the ENOSPC
error.  He won't have a clue how much actually got written.  (With
a writev(2) system call, he should be able to determine how much
got written in addition to the error.)

The solution is to prevent physio(9) from splitting the I/O.  The
new cdev flag, SI_NOSPLIT, tells physio that the driver does not
want I/O to be split beforehand.

Although the sa(4) driver now enables SI_NOSPLIT by default,
that can be disabled by two loader tunables for now.  It will not
be configurable starting in FreeBSD 11.0.  kern.cam.sa.allow_io_split
allows the user to configure I/O splitting for all sa(4) driver
instances.  kern.cam.sa.%d.allow_io_split allows the user to
configure I/O splitting for a specific sa(4) instance.

There are also now three sa(4) driver sysctl variables that let the
users see some sa(4) driver values.  kern.cam.sa.%d.allow_io_split
shows whether I/O splitting is turned on.  kern.cam.sa.%d.maxio shows
the maximum I/O size allowed by kernel configuration parameters
(e.g. MAXPHYS, DFLTPHYS) and the capabilities of the controller.
kern.cam.sa.%d.cpi_maxio shows the maximum I/O size supported by
the controller.

Note that a better long term solution would be to implement support
for chaining buffers, so that that MAXPHYS is no longer a limiting
factor for I/O size to tape and disk devices.  At that point, the
controller and the tape drive would become the limiting factors.

sys/conf.h: Add a new cdev flag, SI_NOSPLIT, that allows a
driver to tell physio not to split up I/O.

sys/param.h: Bump __FreeBSD_version to 1000049 for the addition
of the SI_NOSPLIT cdev flag.

kern_physio.c: If the SI_NOSPLIT flag is set on the cdev, return
any I/O that is larger than si_iosize_max or
MAXPHYS, has more than one segment, or would have
to be split because of misalignment with EFBIG.
(File too large).

In the event of an error, print a console message to
give the user a clue about what happened.

scsi_sa.c: Set the SI_NOSPLIT cdev flag on the devices created
for the sa(4) driver by default.

Add tunables to control whether we allow I/O splitting
in physio(9).

Explain in the comments that allowing I/O splitting
will be deprecated for the sa(4) driver in FreeBSD
11.0.

Add sysctl variables to display the maximum I/O
size we can do (which could be further limited by
read block limits) and the maximum I/O size that
the controller can do.

Limit our maximum I/O size (recorded in the cdev's
si_iosize_max) by MAXPHYS.  This isn't strictly
necessary, because physio(9) will limit it to
MAXPHYS, but it will provide some clarity for the
application.

Record the controller's maximum I/O size reported
in the Path Inquiry CCB.

sa.4: Document the block size behavior, and explain that
the option of allowing physio(9) to split the I/O
will disappear in FreeBSD 11.0.

Sponsored by: Spectra Logic

10 years agoCTL changes required for iSCSI target, most notably LUN remapping
trasz [Sat, 24 Aug 2013 01:50:31 +0000 (01:50 +0000)]
CTL changes required for iSCSI target, most notably LUN remapping
and a mechanism to allow CTL frontends for retrieving LUN options.

Reviewed by: ken (earlier version)

10 years agoMFV r254751:
delphij [Sat, 24 Aug 2013 00:54:47 +0000 (00:54 +0000)]
MFV r254751:

Don't treat the parameter as a number (pool GUID) when there is
error converting it from string, instead, treat it as the pool
name.

Illumos ZFS issues:
  1765 assert triggered in libzfs_import.c trying to import pool
       name beginning with a number

10 years agoMFV r254749:
delphij [Sat, 24 Aug 2013 00:42:37 +0000 (00:42 +0000)]
MFV r254749:

Don't hold dd_lock for long by breaking it when not doing dsl_dir
accounting.  It is not necessary to hold the lock while manipulating
the parent's accounting, because there is no interface for userland
to see a consistent picture of both parent and child at the same
time anyway.

Illumos ZFS issues:
  4046 dsl_dataset_t ds_dir->dd_lock is highly contended

10 years agoGrow some spares in struct vfsops.
alfred [Sat, 24 Aug 2013 00:30:32 +0000 (00:30 +0000)]
Grow some spares in struct vfsops.

This should hopefully prevent ABI breakage
on adding new vfsops in 10.x.