i don't understand what you are doing here. why not just replace the call to rhs.l2_norm() by
  double x = matrix.block(0,1).residual (..., ...);
  double y = rhs.block(1).l2_norm();
  tolerance = solver_tol * sqrt(x*x+y*y);
?