Revert "vsock/loopback: use only sk_buff_head.lock to protect the packet queue"
This reverts commit bb1c9a5907 which is
commit b465518dc27da1ed74b8cbada4659708aac35adb upstream.
It needs to be reverted, as the function virtio_transport_free_pkt() is
in the stable Android ABI, and this function is removed in the 6.1.63
kernel as part of a series of fixes and optimizations of the virtio
networking connection. To preserve the ABI (and thereby keeping the
slower interface), revert the commit for now.
If this needs to come back in the future, if performance for this
interface needs to be resolved, it can be done so in an ABI-safe way.
Bug: 161946584
Change-Id: I5b21a61d82919196c5a386c25eed05055cf77714
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
2b3ea8bdef
commit
7ccdce2dc4
1 changed files with 8 additions and 2 deletions
|
|
@ -15,6 +15,7 @@
|
|||
struct vsock_loopback {
|
||||
struct workqueue_struct *workqueue;
|
||||
|
||||
spinlock_t pkt_list_lock; /* protects pkt_list */
|
||||
struct sk_buff_head pkt_queue;
|
||||
struct work_struct pkt_work;
|
||||
};
|
||||
|
|
@ -31,7 +32,9 @@ static int vsock_loopback_send_pkt(struct sk_buff *skb)
|
|||
struct vsock_loopback *vsock = &the_vsock_loopback;
|
||||
int len = skb->len;
|
||||
|
||||
spin_lock_bh(&vsock->pkt_list_lock);
|
||||
skb_queue_tail(&vsock->pkt_queue, skb);
|
||||
spin_unlock_bh(&vsock->pkt_list_lock);
|
||||
|
||||
queue_work(vsock->workqueue, &vsock->pkt_work);
|
||||
|
||||
|
|
@ -110,9 +113,9 @@ static void vsock_loopback_work(struct work_struct *work)
|
|||
|
||||
skb_queue_head_init(&pkts);
|
||||
|
||||
spin_lock_bh(&vsock->pkt_queue.lock);
|
||||
spin_lock_bh(&vsock->pkt_list_lock);
|
||||
skb_queue_splice_init(&vsock->pkt_queue, &pkts);
|
||||
spin_unlock_bh(&vsock->pkt_queue.lock);
|
||||
spin_unlock_bh(&vsock->pkt_list_lock);
|
||||
|
||||
while ((skb = __skb_dequeue(&pkts))) {
|
||||
virtio_transport_deliver_tap_pkt(skb);
|
||||
|
|
@ -129,6 +132,7 @@ static int __init vsock_loopback_init(void)
|
|||
if (!vsock->workqueue)
|
||||
return -ENOMEM;
|
||||
|
||||
spin_lock_init(&vsock->pkt_list_lock);
|
||||
skb_queue_head_init(&vsock->pkt_queue);
|
||||
INIT_WORK(&vsock->pkt_work, vsock_loopback_work);
|
||||
|
||||
|
|
@ -152,7 +156,9 @@ static void __exit vsock_loopback_exit(void)
|
|||
|
||||
flush_work(&vsock->pkt_work);
|
||||
|
||||
spin_lock_bh(&vsock->pkt_list_lock);
|
||||
virtio_vsock_skb_queue_purge(&vsock->pkt_queue);
|
||||
spin_unlock_bh(&vsock->pkt_list_lock);
|
||||
|
||||
destroy_workqueue(vsock->workqueue);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue