Let $m$ be an integer. If the quadratic equation $x^2 + mx + 3m +1 = 0$ has one or more integer roots, then find the sum of all possible values of $m$.

If $x_1$ and $x_2$ are the roots of this quadratic equation, then by Vieta's formulas, $x_1 + x_2 = -m$ and $x_1 x_2 = 3m + 1$.

If one of the roots is an integer, then $x_1 x_2$ must also be an integer. Since $3m + 1$ is an integer, it follows that $m$ must also be an integer.

Let $y = x_1 + 1$. Then the given quadratic equation rewrites as
\[(y-1)^2 + m(y-1) + 3m + 1 = 0,\quad\text{or } y^2 + (m-2)y + (3m-m^2-1) = 0.\]
Substituting $y+1$ for $x$, $-2-m$ for $m$, and $-3m-m^2-1$ for $3m-m^2-1$, we see that $y+1$ is a root of this equation if and only if $y=x_1+1$ is a root of the original equation.

Thus $x+y=-m+2y$ must be an integer. By Vieta's formulas, it follows that $y$ is an integer if and only if $x+y$ is an integer.
So we need $y+1$ to be an integer root of the equation $y^2 + (m-2)y + (3m-m^2-1) = 0$.

Together with the given, this means that 1 is an integer root of the quadratic equation,
so $0 + (m-2)(0) + (3m-m^2-1) = 0$.
Then $m^2 - 4m - 1 = 0$, and the possible values of $m$ can be found by the quadratic formula:
\[m = \frac{4 \pm \sqrt{4^2 - 4 \cdot (-1)}}{2} = 2 \pm \sqrt5.\]
Hence the sum of all such $m$ is $2 - \sqrt5 + 2 + \sqrt5 = \boxed{4}$.

To find the sum of all possible values of $m$, we need to consider the conditions under which the quadratic equation has integer roots.

The quadratic equation $x^2 + mx + 3m + 1 = 0$ can be factored as $(x + a)(x + b) = 0$, where $a$ and $b$ are the roots of the equation.

Expanding the equation, we get $x^2 + (a + b)x + ab = 0$. Comparing this with the given quadratic equation, we can conclude that $a + b = m$ and $ab = 3m + 1$.

Now, we need to consider the possible values of $m$ for which the roots $a$ and $b$ are integers.

Since $ab = 3m + 1$, we have two cases to consider:

Case 1: $a$ and $b$ are both positive integers
In this case, $a$ and $b$ have the same sign, which means both are either positive or negative. To satisfy $a + b = m$, $m$ must be positive. Let's assume $a > 0$ and $b > 0$. We can write $a = p$ and $b = q$, where $p$ and $q$ are positive integers. Then the equation $ab = 3m + 1$ becomes $pq = 3m + 1$. We need to find all possible positive integer solutions $(p, q)$ that satisfy this equation. The possible values of $p$ and $q$ are:

$(p, q) = (1, 3m + 1)$, where $m$ can take any positive integer value.
$(p, q) = (3, m)$, where $m$ can take any positive integer value.
$(p, q) = (m, 3)$, where $m$ can take any positive integer value.

Case 2: $a$ and $b$ are both negative integers
In this case, $a$ and $b$ both have to be negative integers. We can write $a = -p$ and $b = -q$, where $p$ and $q$ are positive integers. Then the equation $ab = 3m + 1$ becomes $pq = 3m + 1$. We need to find all possible positive integer solutions $(p, q)$ that satisfy this equation. The possible values of $p$ and $q$ are:

$(p, q) = (1, 3m + 1)$, where $m$ can take any negative integer value.
$(p, q) = (3, m)$, where $m$ can take any negative integer value.
$(p, q) = (m, 3)$, where $m$ can take any negative integer value.

To find the sum of all possible values of $m$, we can add up the values from both cases. The sum of all possible values of $m$ is:

$1 + 3m + 1 + 3 + m + 3 + m = \boxed{8m + 8}$.