NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/52211: vioif stops on dmamap load error
The following reply was made to PR kern/52211; it has been noted by GNATS.
From: =?UTF-8?B?SmFyb23DrXIgRG9sZcSNZWs=?= <jaromir.dolecek%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: netbsd-bugs%netbsd.org@localhost
Subject: Re: kern/52211: vioif stops on dmamap load error
Date: Wed, 17 May 2017 00:27:56 +0200
--f403045f284af3cb0f054fabaef0
Content-Type: text/plain; charset="UTF-8"
The driver fails to lock against interrupts without NET_MPSAFE, as it
doesn't do splnet()/splx() as it IMO should. Maybe the biglock
actually is enough, just looks unsafe. IMO it should just always use
the mutexes.
However, the wedge seems to be caused by something else.
If the dmamap load fails while there is no TX active, code still sets
IFF_OACTIVE. The flag is only reset when TX request finishes. Since
nothing ever resets it back, and the start function ignores any
further requests while the flag is set, it would stop sending anything
until interface reset. So minimal fix would be to set the IFF_OACTIVE
only when virtio_enqueue_prep() fails, and leave it alone for the
other errors.
The m_defrag() call anyway looks like good idea - after all it's
better to try to send the data then just dropping it on the floor. I
think it's perfectly possible to have mbufs very fragmented.
Also, the code for trying to dequeue finished requests when we run out
of resources looks somewhat not necessary, IMO it would be simplier to
remove it as it only obfuscates the logic.
What you think about attached patch, based on Masanobu SAITOH's diff?
Besides the things above, I've also changed it so that interface queue
limit is setup according to virtio queue size, i.e. upper layer
wouldn't ever queue more than interface can handle.
Jaromir
2017-05-03 10:40 GMT+02:00 <hannken%eis.cs.tu-bs.de@localhost>:
>>Number: 52211
>>Category: kern
>>Synopsis: vioif stops on dmamap load error
>>Confidential: no
>>Severity: serious
>>Priority: medium
>>Responsible: kern-bug-people
>>State: open
>>Class: sw-bug
>>Submitter-Id: net
>>Arrival-Date: Wed May 03 08:40:00 +0000 2017
>>Originator: Juergen Hannken-Illjes
>>Release: NetBSD 7.1
>>Organization:
>
>>Environment:
>
>
> System: NetBSD vpnserv.isf.cs.tu-bs.de 7.1 NetBSD 7.1 (gateway.i386) #0: Mon Mar 13 16:40:12 MET 2017 build%builder.isf.cs.tu-bs.de@localhost:/build/nbsd7/obj/obj.i386/sys/arch/i386/compile/gateway.i386 i386
> Architecture: i386
> Machine: i386
>>Description:
>
> From time to time the machine prints
>
> vioif0: tx dmamap load failed, error code 27
>
> and most times the interface seems to stop as the machine is no longer
> accessible from the network.
>
> $NetBSD: if_vioif.c,v 1.7.2.3 2016/12/23 05:57:40 snj Exp $
>>How-To-Repeat:
>
>>Fix:
>
>
>>Unformatted:
>
>
--f403045f284af3cb0f054fabaef0
Content-Type: text/plain; charset="US-ASCII"; name="if_vioif_wedge_fix.diff"
Content-Disposition: attachment; filename="if_vioif_wedge_fix.diff"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_j2s4jecc0
SW5kZXg6IGlmX3Zpb2lmLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2N2c3Jvb3Qvc3JjL3N5cy9k
ZXYvcGNpL2lmX3Zpb2lmLmMsdgpyZXRyaWV2aW5nIHJldmlzaW9uIDEuMzQKZGlmZiAtdSAtcCAt
cjEuMzQgaWZfdmlvaWYuYwotLS0gaWZfdmlvaWYuYwkyOCBNYXIgMjAxNyAwNDoxMDozMyAtMDAw
MAkxLjM0CisrKyBpZl92aW9pZi5jCTE2IE1heSAyMDE3IDIyOjIyOjMyIC0wMDAwCkBAIC0yMjYs
OCArMjI2LDggQEAgc3RydWN0IHZpb2lmX3NvZnRjIHsKIAl9CQkJc2NfY3RybF9pbnVzZTsKIAlr
Y29uZHZhcl90CQlzY19jdHJsX3dhaXQ7CiAJa211dGV4X3QJCXNjX2N0cmxfd2FpdF9sb2NrOwot
CWttdXRleF90CQkqc2NfdHhfbG9jazsKLQlrbXV0ZXhfdAkJKnNjX3J4X2xvY2s7CisJa211dGV4
X3QJCXNjX3R4X2xvY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