The root of guru devotion is the most important thing that determines how quickly we reach enlightenment, how strongly we need, rely upon and devote our self to your guru—the stronger, the quicker.
As what Drogön Tsangpa Gyare (see Liberation in the Palm of Your Hand, p. 262) said: If the guru beats you, it is an initiation. "Dung dak chung wa wang po yin": If the guru scolds, you, it's a wrathful mantra pacifying the obstacles to practicing the Dharma or to enlightenment. You see, when there are obstacles in life, normally people recite wrathful mantras for pacification, and perform wrathful pujas. It is the same if the guru scolds you. This is the wrathful mantra pacifying the obstacles to achieving enlightenment. Also, if there are obstacles that need to be eliminated, the scolding eliminates them. Think that your teacher is showing this aspect purposefully to purify your mind, to guide you and bring you to enlightenment.
Sometimes the guru is so happy with us, but externally shows the aspect of being unhappy, beats us, scolds us, but also sometimes shows the external aspect of being happy, but inside is not happy. This shows that our Guru is compassionate to use different skilful methods to help us purify our negative karma depending on the level of our mind and the intensity of our karma.