Skip to contentSkip to conversation

vnif socket buffer mistaken for pagetable page causes major performance problem

DISCUSSION Dan Magenheimer 3 participants 5 messages May 6, 2009 – Jun 9, 2009

lore
Share & tools
lore
#0 lore raw

A recent posting reminded me of this and, though the information is a bit vague, someone familiar with the shadow code might know just where to look to fix this, hopefully in time for 3.4 (if its not already fixed).

One of our performance experts discovered a strange major network performance hit seen only under certain circumstances, IIRC mostly in HVM but sometimes in PV when migrating.

With some help from Intel, it was determined that the heuristics used by shadow paging to determine whether a guest is modifying a pagetable page were getting fooled by the access pattern used by the code that copies data into a newly allocated socket buffer. As a result, many unnecessary vmenter/vmexits were happening.

The workaround was to preallocate all socket buffer memory.

That's all I've got, but we can try to answer questions if this isn't already a known fixed problem.

Dan

#1 lore raw

Hi,

Sorry for the late reply,

Quoted 18 lines · Dan Magenheimer

A recent posting reminded me of this and, though the information is a bit vague, someone familiar with the shadow code might know just where to look to fix this, hopefully in time for 3.4 (if its not already fixed).

One of our performance experts discovered a strange major network performance hit seen only under certain circumstances, IIRC mostly in HVM but sometimes in PV when migrating.

With some help from Intel, it was determined that the heuristics used by shadow paging to determine whether a guest is modifying a pagetable page were getting fooled by the access pattern used by the code that copies data into a newly allocated socket buffer. As a result, many unnecessary vmenter/vmexits were happening.

Quoted 5 lines

The workaround was to preallocate all socket buffer memory.

That's all I've got, but we can try to answer questions if this isn't already a known fixed problem.

Can you be a little more specific about what is the performance loss, in what workload, and what heuristic you found to be wrong in this case?

Thanks,
Gianluca

#2 lore raw
Quoted 23 lines · Gianluca Guida

Hi,

Sorry for the late reply,

Quoted 18 lines · Dan Magenheimer

A recent posting reminded me of this and, though the information is a bit vague, someone familiar with the shadow code might know just where to look to fix this, hopefully in time for 3.4 (if its not already fixed).

One of our performance experts discovered a strange major network performance hit seen only under certain circumstances, IIRC mostly in HVM but sometimes in PV when migrating.

With some help from Intel, it was determined that the heuristics used by shadow paging to determine whether a guest is modifying a pagetable page were getting fooled by the access pattern used by the code that copies data into a newly allocated socket buffer. As a result, many unnecessary vmenter/vmexits were happening.

Quoted 7 lines
Quoted 5 lines

The workaround was to preallocate all socket buffer memory.

That's all I've got, but we can try to answer questions if this isn't already a known fixed problem.

Can you be a little more specific about what is the performance loss,

Network throughput was reduced to 10% of normal.

Quoted 1 line

in what workload,

A network send throughput test using netperf.

Quoted 1 line

and what heuristic you found to be wrong in this case?

The access pattern to the memory page that was recognized as a pagetable access was a regular memcpy doing 4 byte aligned writes into a newly allocated page. I'm not that familiar with the shadow pagetable code, so I don't know how "wrong" this is, just that it caused a false positive on this type of memory access.

Thanks,
Herbert.

#3 lore raw
Quoted 4 lines · Herbert van den Bergh
Quoted 1 line

Can you be a little more specific about what is the performance loss,

Network throughput was reduced to 10% of normal.

Quoted 1 line

in what workload,

A network send throughput test using netperf.

This is with a Linux guest (HVM of course), right?

Quoted 2 lines
Quoted 1 line

and what heuristic you found to be wrong in this case?

The access pattern to the memory page that was recognized as a pagetable access was a regular memcpy doing 4 byte aligned writes into a newly allocated page. I'm not that familiar with the shadow pagetable code, so I don't know how "wrong" this is, just that it caused a false positive on this type of memory access.

Most probably the guest OS is recycling a page that used to be a pagetable and that is still shadowed.

Thanks,
Gianluca

#4 lore raw
Quoted 7 lines · Gianluca Guida
Quoted 4 lines · Herbert van den Bergh
Quoted 1 line

Can you be a little more specific about what is the performance loss,

Network throughput was reduced to 10% of normal.

Quoted 1 line

in what workload,

A network send throughput test using netperf.

This is with a Linux guest (HVM of course), right?

Right.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

and what heuristic you found to be wrong in this case?

The access pattern to the memory page that was recognized as a pagetable access was a regular memcpy doing 4 byte aligned writes into a newly allocated page. I'm not that familiar with the shadow pagetable code, so I don't know how "wrong" this is, just that it caused a false positive on this type of memory access.

Most probably the guest OS is recycling a page that used to be a pagetable and that is still shadowed.

Thanks,
Gianluca