The knowledge of effective masses is a key ingredient to analyze numerous properties of semiconductors, like carrier mobilities, (magneto)transport properties, or band extrema characteristics yielding carrier densities and density of states. Currently, these masses are usually calculated using finite-difference estimation of density functional theory (DFT) electronic band curvatures. However, finite differences require an additional convergence study and are prone to numerical noise. Moreover, the concept of effective mass breaks down at degenerate band extrema. We assess the former limitation by developing a method that allows to obtain the Hessian of DFT bands directly, using density functional perturbation theory. Then, we solve the latter issue by adapting the concept of "transport equivalent effective mass" to the k·p framework. The numerical noise inherent to finite-difference methods is thus eliminated, along with the associated convergence study. The resulting method is therefore more general, more robust, and simpler to use, which makes it especially appropriate for high-throughput computing. After validating the developed techniques, we apply them to the study of silicon, graphane, and arsenic. The formalism is implemented into the abinit software and supports the norm-conserving pseudopotential approach, the projector augmented-wave method, and the inclusion of spin-orbit coupling. The derived expressions also apply to the ultrasoft pseudopotential method.