Em Fri, 21 Jun 2024 19:33:16 +0100
Jonathan Cameron <jonathan.came...@huawei.com> escreveu:

> On Fri, 21 Jun 2024 17:51:15 +0100
> <shiju.j...@huawei.com> wrote:
> 
> > From: Shiju Jose <shiju.j...@huawei.com>  
> Thanks for posting this.
> 
> Given this is going to linux-edac, probably should mention
> this is QEMU based error injection.  For cross postings
> between kernel related and qemu lists I tend to stick
> qemu in the [] of the patch description.

Thank you for that! It is really useful. Btw, I'm using a small
script to do the error injection using netcat (nc), and assuming
that the QMP interface used for error injection will be started 
at localhost port 4445, e. g. qemu is started with:

        -qmp tcp:localhost:4445,server=on,wait=off

Btw, I added some instructions about how to use it under rasdaemon
page:

        https://github.com/mchehab/rasdaemon/wiki/Error-injection-testing

Feel free to improve it.

Thanks,
Mauro

---


#!/bin/bash

trap 'catch $LINENO "$BASH_COMMAND"' ERR
catch() {
        echo "Error on line $1: $2"
        exit 1
}

ERROR_DEFAULT='"cache-error"'
ERROR=""

HELP="$0 [<-c|--cache-error> <-t|--tlb-error> <-b|--bus-error> 
<-v|--vendor-error>|--micro-arch-error]"

while [ "$1" != "" ]; do
        case "$1" in
                -c|--cache-error)
                        if [ ! -z "$ERROR" ]; then ERROR="$ERROR, "; fi
                        ERROR+='"cache-error"'
                        ;;
                -t|--tlb-error)
                        if [ ! -z "$ERROR" ]; then ERROR="$ERROR, "; fi
                        ERROR+='"tlb-error"'
                        ;;
                -b|--bus-error)
                        if [ ! -z "$ERROR" ]; then ERROR="$ERROR, "; fi
                        ERROR+='"bus-error"'
                        ;;
                -v|--vendor-error|--micro-arch-error)
                        if [ ! -z "$ERROR" ]; then ERROR="$ERROR, "; fi
                        ERROR+='"micro-arch-error"'
                        ;;
                help|-h|--help)
                        echo $HELP
                        exit 0
                        ;;
        esac
        shift
done


if [ -z "$ERROR" ]; then
        ERROR=$ERROR_DEFAULT
fi

CACHE_MSG='{ "execute": "qmp_capabilities" } '
CACHE_MSG+='{ "execute": "arm-inject-error", "arguments": { "errortypes": 
['$ERROR'] } }'

echo $CACHE_MSG
echo $CACHE_MSG | nc -v localhost 4445



Reply via email to