When is it appropriate for a PhD student to discuss personal problems affecting his productivity with his advisor?
As soon as possible. Problems are made to be transcended, not pushed over time. You already said your adviser is a cool guy, right? Go ahead and talk with him, say the truth.

It's a long said term, even cliche sometimes, but the first step to change is recognizing that you have a problem. You already recognized you have it, so now it's time to fix it. Don't be afraid of what he'll think about you, what really matters is that it's true. If he can't understand your situation, then he doesn't really know how to be a adviser.

Also, you're a student, you're there to learn. Better learn now where you can be mistaken with no serious consequences, then out there, where your problem can really damage you financially and/or much more emotionally, since people don't know how to handle with other people's problems, or know and just don't care.