I am not an expert of Riemannian geometry (coming mainly from functional analysis in $\mathbb R^n$).
Let $(M,g)$ be a compact $n$-dimensional Riemannian manifold with Ricci curvature bounded from below (and with boundary, or - also - a domain in a complete manifold). I am interested in the quantity $$ Q(f)=\int_M |Hess f|^2+Ric(\nabla f,\nabla f)dv_g $$ with $f\in H^2(M)$. Here $|Hess f|^2$ denotes the squared Frobenius norm of the Hessian of $f$, which in coordinates reads $|Hess f|^2=g^{ij}g^{kl}(\partial_{ik}f-\Gamma_{ik}^m\partial_m f)(\partial_{jl}f-\Gamma_{jl}^m\partial_m f)$
Clearly by Bochner formula $$ |Hess f|^2+Ric(\nabla f,\nabla f)=\frac{1}{2}\Delta(|\nabla f|^2)-<\nabla\Delta f,\nabla f> $$ and by approximation we have that $Q(f)\geq 0$ whenever $f\in H^2_0(M)$ or $M$ has no boundary.
My question is: is this true in general for any $f\in H^2(M)$ and $M$ with boundary?
Also, is the integrand (by looking at Bochner's formula) always non-negative (pointwise) when $u$ is a smooth function?
I really can't figure out that, but it seems reasonable that $Q(f)\geq 0$.