Skip to contentSkip to conversation

Deadlock condition due to virtqueue_add buffer allocation

Query Nitesh Narayan Lal 2 participants 3 messages Jul 28, 2017 – Aug 1, 2017 KVM

lore
Share & tools
lore
#0 lore raw

Hi,

I am working on the guest page hinting support with Rik.
As per my implementation when pages are freed, they are added to a cpu-local list. Once that list fills up, the pages need to be passed to the hypervisor. I am currently using a seqlock to ensure page allocation does not allocate pages while they are being freed by the hypervisor. This list is passed to the hypervisor using virtio_balloon infrastructure. As per the current flow virtqueue_add() requires a memory allocation, which leads to a deadlock condition.

What should be the right way to get around this?

Looking forward for the suggestions.

Signature · 2 lines
Regards
Nitesh
#1 lore raw
Quoted 11 lines · Nitesh Narayan Lal

Hi,

I am working on the guest page hinting support with Rik.
As per my implementation when pages are freed, they are added to a cpu-local list. Once that list fills up, the pages need to be passed to the hypervisor. I am currently using a seqlock to ensure page allocation does not allocate pages while they are being freed by the hypervisor. This list is passed to the hypervisor using virtio_balloon infrastructure. As per the current flow virtqueue_add() requires a memory allocation, which leads to a deadlock condition.

Quoted 4 lines

What should be the right way to get around this?

Looking forward for the suggestions.

Hi Nitesh,

I am interesting on the idea. Could you give more details of the background? What page hinting can help and what's the expected usage model?

Signature · 2 lines
Yang
Alibaba Cloud Computing
#2 lore raw
Quoted 14 lines · Yang Zhang
Quoted 13 lines · Nitesh Narayan Lal

Hi,

I am working on the guest page hinting support with Rik.
As per my implementation when pages are freed, they are added to a cpu-local list. Once that list fills up, the pages need to be passed to the hypervisor. I am currently using a seqlock to ensure page allocation does not allocate pages while they are being freed by the hypervisor. This list is passed to the hypervisor using virtio_balloon infrastructure. As per the current flow virtqueue_add() requires a memory allocation, which leads to a deadlock condition.

What should be the right way to get around this?

Quoted 9 lines
Quoted 2 lines

Looking forward for the suggestions.

Hi Nitesh,

I am interesting on the idea. Could you give more details of the background? What page hinting can help and what's the expected usage model?

Hi Yang,

Basically page hinting support will help in handing of free memory between the guest and the host rapidly and transparently. It will also enable the guest to reuse the memory again with the use of MADV_FREE on the host side.
I will be sharing the first patch-set soon, please feel free to make any suggestion which you feel are required.

Signature · 2 lines
Regards
Nitesh