If $E, F$ are real finite dimensional vector spaces and $\mu\colon E \to F$, we can speak of a (total) derivative of $\mu$ in Fréchet sense: $D\mu$, if it exists, is the unique mapping from $E$ to $L(E; F)$, the vector space of linear $E\to F$ mappings, such that for all $x, x_0\in E$ we have
$$\mu(x)=\mu(x_0)+D\mu(x_0)(x-x_0)+o(\lvert x-x_0\rvert). $$
Now since $L(E;F)$ is a vector space itself, the construction can be iterated yielding higher-order derivatives $D^2\mu=D(D\mu), D^3\mu=D(D^2\mu)\ldots$
The concept of first derivative extends to maps $\mu\colon M \to N$ with $M, N$ smooth manifolds, in which case $D\mu\colon TM \to TN$ is defined by
$$D\mu(X_p)(f)=X_p(\mu \circ f), \qquad \forall p \in M,\ \forall X_p \in T_pM,\ \forall f \in C^\infty(N).$$
Question. What about second derivatives? How to generalize the above construction from vector spaces to smooth manifolds?
The obvious way, that of taking $D^2\mu=D(D\mu)$, seems a bit awkward because it involves the complicated tangent-bundle-of-tangent-bundle $T(TM)$. Also, if $\mu=f \colon M \to \mathbb{R}$, I would expect the definition to boil down to
$$D^2f(X_p, Y_p)=(X_pY_p)(f), \qquad \forall p \in M, \forall X_p, Y_p \in T_pM.$$
I would use some reference material on this question and its applications.
Thank you.