depends on the engine but I do recall from the 5th gear show and swirl flaps. One of the signs on the x5 6cyl engines was hunting for revs. Friend of mine had similar on his x5 engine would hunt for revs on inspection the flaps where removed blanked off and problem went away.
Question is does it do it when idling. Is yours the LCI engine or pre LCI.
F30 335i M Sport