  Burq-G\'erard-Tzvetkov and Hu established $L^p$ estimates ($2\le p\le
\infty$) for the restriction of eigenfunctions to submanifolds. The estimates
are sharp, except for the log loss at the endpoint $L^2$ estimates for
submanifolds of codimension 2. It has long been believed that the log loss at
the endpoint can be removed in general, while the problem is still open. So
this paper is devoted to the study of sharp endpoint restriction estimates for
eigenfunctions in this case. Chen and Sogge removed the log loss for the
geodesics on 3-dimensional manifolds. In this paper, we generalize their result
to higher dimensions and prove that the log loss can be removed for totally
geodesic submanifolds of codimension 2. Moreover, on 3-dimensional manifolds,
we can remove the log loss for curves with nonvanishing geodesic curvatures,
and more general finite type curves. The problem in 3D is essentially related
to Hilbert transforms along curves in the plane and a class of singular
oscillatory integrals studied by Phong-Stein, Ricci-Stein, Pan, Seeger,
Carbery-P\'erez.
