#!/bin/bash # Intel MIC Platform Software Stack (MPSS) # # Copyright(c) 2013 Intel Corporation. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License, version 2, as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # The full GNU General Public License is included in this distribution in # the file called "COPYING". # # Intel MIC User Space Tools. # # mpss Start mpssd. # # chkconfig: 2345 95 05 # description: start MPSS stack processing. # ### BEGIN INIT INFO # Provides: mpss # Required-Start: # Required-Stop: # Short-Description: MPSS stack control # Description: MPSS stack control ### END INIT INFO # Source function library. . /etc/init.d/functions exec=/usr/sbin/mpssd sysfs="/sys/class/mic" mic_modules="mic_host mic_x100_dma scif vop" start() { [ -x $exec ] || exit 5 if [ "`ps -e | awk '{print $4}' | grep mpssd | head -1`" = "mpssd" ]; then echo -e $"MPSSD already running! " success echo return 0 fi echo -e $"Starting MPSS Stack" echo -e $"Loading MIC drivers:" $mic_modules modprobe -a $mic_modules RETVAL=$? if [ $RETVAL -ne 0 ]; then failure echo return $RETVAL fi # Start the daemon echo -n $"Starting MPSSD " $exec RETVAL=$? if [ $RETVAL -ne 0 ]; then failure echo return $RETVAL fi success echo sleep 5 # Boot the cards micctrl -b # Wait till ping works for f in $sysfs/* do count=100 ipaddr=`cat $f/cmdline` ipaddr=${ipaddr#*address,} ipaddr=`echo $ipaddr | cut -d, -f1 | cut -d\; -f1` while [ $count -ge 0 ] do echo -e "Pinging "`basename $f`" " ping -c 1 $ipaddr &> /dev/null RETVAL=$? if [ $RETVAL -eq 0 ]; then success break fi sleep 1 count=`expr $count - 1` done [ $RETVAL -ne 0 ] && failure || success echo done return $RETVAL } stop() { echo -e $"Shutting down MPSS Stack: " # Bail out if module is unloaded if [ ! -d "$sysfs" ]; then echo -n $"Module unloaded " success echo return 0 fi # Shut down the cards. micctrl -S # Wait for the cards to go offline for f in $sysfs/* do while [ "`cat $f/state`" != "ready" ] do sleep 1 echo -e "Waiting for "`basename $f`" to become ready" done done # Display the status of the cards micctrl -s # Kill MPSSD now echo -n $"Killing MPSSD" killall -9 mpssd 2>/dev/null RETVAL=$? [ $RETVAL -ne 0 ] && failure || success echo return $RETVAL } restart() { stop sleep 5 start } status() { micctrl -s if [ "`ps -e | awk '{print $4}' | grep mpssd | head -n 1`" = "mpssd" ]; then echo "mpssd is running" else echo "mpssd is stopped" fi return 0 } unload() { if [ ! -d "$sysfs" ]; then echo -n $"No MIC_HOST Module: " success echo return fi stop sleep 5 echo -n $"Removing MIC drivers:" $mic_modules modprobe -r $mic_modules RETVAL=$? [ $RETVAL -ne 0 ] && failure || success echo return $RETVAL } case $1 in start) start ;; stop) stop ;; restart) restart ;; status) status ;; unload) unload ;; *) echo $"Usage: $0 {start|stop|restart|status|unload}" exit 2 esac exit $? hod='get'>
context:
space:
mode:
authorIago Abal <mail@iagoabal.eu>2017-01-11 14:00:21 +0100
committerVinod Koul <vinod.koul@intel.com>2017-01-25 15:35:11 +0530
commit91539eb1fda2d530d3b268eef542c5414e54bf1a (patch)
tree960f5ca6342ad20837aff18aad6e8ecd7da32fd6 /fs/xfs/libxfs/xfs_dquot_buf.c
parent6610d0edf6dc7ee97e46ab3a538a565c79d26199 (diff)
dmaengine: pl330: fix double lock
The static bug finder EBA (http://www.iagoabal.eu/eba/) reported the following double-lock bug: Double lock: 1. spin_lock_irqsave(pch->lock, flags) at pl330_free_chan_resources:2236; 2. call to function `pl330_release_channel' immediately after; 3. call to function `dma_pl330_rqcb' in line 1753; 4. spin_lock_irqsave(pch->lock, flags) at dma_pl330_rqcb:1505. I have fixed it as suggested by Marek Szyprowski. First, I have replaced `pch->lock' with `pl330->lock' in functions `pl330_alloc_chan_resources' and `pl330_free_chan_resources'. This avoids the double-lock by acquiring a different lock than `dma_pl330_rqcb'. NOTE that, as a result, `pl330_free_chan_resources' executes `list_splice_tail_init' on `pch->work_list' under lock `pl330->lock', whereas in the rest of the code `pch->work_list' is protected by `pch->lock'. I don't know if this may cause race conditions. Similarly `pch->cyclic' is written by `pl330_alloc_chan_resources' under `pl330->lock' but read by `pl330_tx_submit' under `pch->lock'. Second, I have removed locking from `pl330_request_channel' and `pl330_release_channel' functions. Function `pl330_request_channel' is only called from `pl330_alloc_chan_resources', so the lock is already held. Function `pl330_release_channel' is called from `pl330_free_chan_resources', which already holds the lock, and from `pl330_del'. Function `pl330_del' is called in an error path of `pl330_probe' and at the end of `pl330_remove', but I assume that there cannot be concurrent accesses to the protected data at those points. Signed-off-by: Iago Abal <mail@iagoabal.eu> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_dquot_buf.c')