#!/bin/bash # This example script creates bonding network devices based on synthetic NIC # (the virtual network adapter usually provided by Hyper-V) and the matching # VF NIC (SRIOV virtual function). So the synthetic NIC and VF NIC can # function as one network device, and fail over to the synthetic NIC if VF is # down. # # Usage: # - After configured vSwitch and vNIC with SRIOV, start Linux virtual # machine (VM) # - Run this scripts on the VM. It will create configuration files in # distro specific directory. # - Reboot the VM, so that the bonding config are enabled. # # The config files are DHCP by default. You may edit them if you need to change # to Static IP or change other settings. # sysdir=/sys/class/net netvsc_cls={f8615163-df3e-46c5-913f-f2d2f965ed0e} bondcnt=0 # Detect Distro if [ -f /etc/redhat-release ]; then cfgdir=/etc/sysconfig/network-scripts distro=redhat elif grep -q 'Ubuntu' /etc/issue then cfgdir=/etc/network distro=ubuntu elif grep -q 'SUSE' /etc/issue then cfgdir=/etc/sysconfig/network distro=suse else echo "Unsupported Distro" exit 1 fi echo Detected Distro: $distro, or compatible # Get a list of ethernet names list_eth=(`cd $sysdir && ls -d */ | cut -d/ -f1 | grep -v bond`) eth_cnt=${#list_eth[@]} echo List of net devices: # Get the MAC addresses for (( i=0; i < $eth_cnt; i++ )) do list_mac[$i]=`cat $sysdir/${list_eth[$i]}/address` echo ${list_eth[$i]}, ${list_mac[$i]} done # Find NIC with matching MAC for (( i=0; i < $eth_cnt-1; i++ )) do for (( j=i+1; j < $eth_cnt; j++ )) do if [ "${list_mac[$i]}" = "${list_mac[$j]}" ] then list_match[$i]=${list_eth[$j]} break fi done done function create_eth_cfg_redhat { local fn=$cfgdir/ifcfg-$1 rm -f $fn echo DEVICE=$1 >>$fn echo TYPE=Ethernet >>$fn echo BOOTPROTO=none >>$fn echo UUID=`uuidgen` >>$fn echo ONBOOT=yes >>$fn echo PEERDNS=yes >>$fn echo IPV6INIT=yes >>$fn echo MASTER=$2 >>$fn echo SLAVE=yes >>$fn } function create_eth_cfg_pri_redhat { create_eth_cfg_redhat $1 $2 } function create_bond_cfg_redhat { local fn=$cfgdir/ifcfg-$1 rm -f $fn echo DEVICE=$1 >>$fn echo TYPE=Bond >>$fn echo BOOTPROTO=dhcp >>$fn echo UUID=`uuidgen` >>$fn echo ONBOOT=yes >>$fn echo PEERDNS=yes >>$fn echo IPV6INIT=yes >>$fn echo BONDING_MASTER=yes >>$fn echo BONDING_OPTS=\"mode=active-backup miimon=100 primary=$2\" >>$fn } function create_eth_cfg_ubuntu { local fn=$cfgdir/interfaces echo $'\n'auto $1 >>$fn echo iface $1 inet manual >>$fn echo bond-master $2 >>$fn } function create_eth_cfg_pri_ubuntu { local fn=$cfgdir/interfaces create_eth_cfg_ubuntu $1 $2 echo bond-primary $1 >>$fn } function create_bond_cfg_ubuntu { local fn=$cfgdir/interfaces echo $'\n'auto $1 >>$fn echo iface $1 inet dhcp >>$fn echo bond-mode active-backup >>$fn echo bond-miimon 100 >>$fn echo bond-slaves none >>$fn } function create_eth_cfg_suse { local fn=$cfgdir/ifcfg-$1 rm -f $fn echo BOOTPROTO=none >>$fn echo STARTMODE=auto >>$fn } function create_eth_cfg_pri_suse { create_eth_cfg_suse $1 } function create_bond_cfg_suse { local fn=$cfgdir/ifcfg-$1 rm -f $fn echo BOOTPROTO=dhcp >>$fn echo STARTMODE=auto >>$fn echo BONDING_MASTER=yes >>$fn echo BONDING_SLAVE_0=$2 >>$fn echo BONDING_SLAVE_1=$3 >>$fn echo BONDING_MODULE_OPTS=\'mode=active-backup miimon=100 primary=$2\' >>$fn } function create_bond { local bondname=bond$bondcnt local primary local secondary local class_id1=`cat $sysdir/$1/device/class_id 2>/dev/null` local class_id2=`cat $sysdir/$2/device/class_id 2>/dev/null` if [ "$class_id1" = "$netvsc_cls" ] then primary=$2 secondary=$1 elif [ "$class_id2" = "$netvsc_cls" ] then primary=$1 secondary=$2 else return 0 fi echo $'\nBond name:' $bondname echo configuring $primary create_eth_cfg_pri_$distro $primary $bondname echo configuring $secondary create_eth_cfg_$distro $secondary $bondname echo creating: $bondname with primary slave: $primary create_bond_cfg_$distro $bondname $primary $secondary let bondcnt=bondcnt+1 } for (( i=0; i < $eth_cnt-1; i++ )) do if [ -n "${list_match[$i]}" ] then create_bond ${list_eth[$i]} ${list_match[$i]} fi done >6space:mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-29 13:50:06 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-29 13:50:06 -0800
commit39cb2c9a316e77f6dfba96c543e55b6672d5a37e (patch)
tree98fe974ee4e20121253de7f61fc8d01bdb3821c1 /tools/testing/selftests/ftrace/test.d/template
parent2c5d9555d6d937966d79d4c6529a5f7b9206e405 (diff)
drm/i915: Check for NULL i915_vma in intel_unpin_fb_obj()
I've seen this trigger twice now, where the i915_gem_object_to_ggtt() call in intel_unpin_fb_obj() returns NULL, resulting in an oops immediately afterwards as the (inlined) call to i915_vma_unpin_fence() tries to dereference it. It seems to be some race condition where the object is going away at shutdown time, since both times happened when shutting down the X server. The call chains were different: - VT ioctl(KDSETMODE, KD_TEXT): intel_cleanup_plane_fb+0x5b/0xa0 [i915] drm_atomic_helper_cleanup_planes+0x6f/0x90 [drm_kms_helper] intel_atomic_commit_tail+0x749/0xfe0 [i915] intel_atomic_commit+0x3cb/0x4f0 [i915] drm_atomic_commit+0x4b/0x50 [drm] restore_fbdev_mode+0x14c/0x2a0 [drm_kms_helper] drm_fb_helper_restore_fbdev_mode_unlocked+0x34/0x80 [drm_kms_helper] drm_fb_helper_set_par+0x2d/0x60 [drm_kms_helper] intel_fbdev_set_par+0x18/0x70 [i915] fb_set_var+0x236/0x460 fbcon_blank+0x30f/0x350 do_unblank_screen+0xd2/0x1a0 vt_ioctl+0x507/0x12a0 tty_ioctl+0x355/0xc30 do_vfs_ioctl+0xa3/0x5e0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x13/0x94 - i915 unpin_work workqueue: intel_unpin_work_fn+0x58/0x140 [i915] process_one_work+0x1f1/0x480 worker_thread+0x48/0x4d0 kthread+0x101/0x140 and this patch purely papers over the issue by adding a NULL pointer check and a WARN_ON_ONCE() to avoid the oops that would then generally make the machine unresponsive. Other callers of i915_gem_object_to_ggtt() seem to also check for the returned pointer being NULL and warn about it, so this clearly has happened before in other places. [ Reported it originally to the i915 developers on Jan 8, applying the ugly workaround on my own now after triggering the problem for the second time with no feedback. This is likely to be the same bug reported as https://bugs.freedesktop.org/show_bug.cgi?id=98829 https://bugs.freedesktop.org/show_bug.cgi?id=99134 which has a patch for the underlying problem, but it hasn't gotten to me, so I'm applying the workaround. ] Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Imre Deak <imre.deak@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools/testing/selftests/ftrace/test.d/template')