Let $X$ be a smooth algebraic variety over $\mathbb{C}$ (or a field of characteristic zero). We have $D_X$ the sheaf of differential operators on $X$, which is a coherent sheaf of rings, and it carries the canonical increasing filtration $D_X^n$ by the order of differential operators, whose associated graded ring $grD_X$ is identified with the function ring of the cotangent bundle of $X$.For $M$ a coherent $D_X$-module (finite type as $D_X$-module and quasi-coherent as $O_X$-module), we can talk about the notion of good filtration on $M$: it is a increasing filtration $M_n$ by quasi-coherent $O_X$-modules, compatible with $D_X^n$ for the $D_X$-module structure of $M$, such that the associated graded module is of finite type over $grD_X$.

For coherent $D_X$-module $M$, good filtration exists locally over $X$, and in many case this is already sufficiently useful. For example it leads to the notion of characteristic cycles, etc. But my question is when do we do have globally defined good filtration $M_n$ for $M$, such that $D_X^nM_m=M_{n+m}$ for all $m,n\geq 0$?

A natural example one can find is in the D-affine case: $X$ is D-affine if the global section functor establishes an equivalence between coherent $D_X$ modules and coherent $\Gamma(X,D_X)$-modules. In this case a coherent $D_X$-module $M$ with global section $N$ is equipped with a global good filtration $D_X^nN$. Conversely, if every coherent $D_X$-module admits a global good filtration, how far is $X$ from being $D_X$-affine? This seems to be too optimistic.

Another question: if we only consider coherent $D_X$-modules coming from flat connection on vector bundles (coherent as $O_X$-modules), do we always have global good filtration?

By the way, for $X$ a Zariski open subset of $Y$ a smooth variety, does the D-affinity of $Y$ implies the D-affinity of $X$?

Many thanks!