Does PV work violate conservation of energy? Suppose a container separating two gases via a movable massless piston. If the pressure of gas 1 is higher than that of gas 2, the piston will move. In an infinitesimal volume change, the energy lost by gas 1 will be P1.dV and that gained by gas 2 will be P2.dV. As P1 is higher than P2, where is the extra energy going?
Note: no heat exchange is considered. The only change in energy is caused by work.
 A: Let the system $1$ be one gas, the system $2$ be the other gas, and $P$ be the piston. The process is short enough to consider it adiabatic, so the first principle of thermodynamics gives
$$ \textrm{d}E_p + \textrm{d}U_1 + \textrm{d}U_2 = \delta W_{ext} $$
where $E_p$ is the mechanical energy of the piston and $W_{ext}$ the work done by the operator. Indeed, $\textrm{d}U_p = 0$ since the piston is a rigid body and there is no heat transfer, and $\textrm{d}E_1 = \textrm{d}E_2 = 0$ in the first order since the transformation is infinitesimal.
However, the process can be quasi-static, so $\textrm{d}E_p = 0$, so we got
$$ \textrm{d}U_1 + \textrm{d}U_2 = \delta W_{ext}$$
Here, you made the following mistake: you said that $\delta W_{ext} = 0$, but this is physically impossible. Indeed, $P_1 \neq P_2$, so the piston won't evolve smoothly at all if there's no external force applied on it. Thus, if the process is quasi-static, then there is an external force, so
$$ \textrm{d}U_1 + \textrm{d}U_2 \neq 0 $$
But we can also say that the operator doesn't touch the device. Then, $\delta W_{ext} = 0$, however the kinetic energy of the piston have changed during the process, so $\textrm{d}E_p \neq 0$, which gives
$$ \textrm{d}U_1 + \textrm{d}U_2 \neq 0$$
In both cases, at first sight the conservation of energy is violated, however once you've taken the piston into account, there's no problem anymore.
A: The correct answer to your question is simply that the changes in energy are not $P_1dV$ on one side and $P_2dV$ on the other side.    The changes in energy are $-(P_1-P_2)dV$ on the high pressure side and $(P_1-P_2)dV$ on the low pressure side.   There is no "extra energy" to account for.
Explanation:    
$dV$ is equal to $Adx$, where $A$ is the area of the piston and $dx$ is its displacement.    The force on the high pressure side of the piston is $P_1A$, and the force on the low pressure side is $-P_2A$.    The net force is the sum of the two, $(P_1-P_2)A$, and the energy transferred, or work done, is the product of this net force and the displacement $dx$.   The work is done by the high pressure chamber on the low pressure chamber, so it is negative for the former and positive for the latter.
