Getting a perfect straight line next to the ceiling is difficult and takes practice with a brush, free hand. I do have a couple of ideas. Which one applies to you depends on the texture on the walls and ceiling.
1- Taping doesn't work very well if you have a texture surface, orange peel or knock down textures. You could apply a little caulk to this corner, were the wall and ceiling meet, to give a smoother surface for the tape to stick to. This also helps with freehand brushing.
2- You could use <a href="//www.painters-toys.com/frogtape.html" target="_blank">Frog Tape</a>. Frog Tape is a different kind of tape that swells a little on the edge when paint is applied. This helps block the paint from getting to the ceiling. Success depends on the amount of texture.
3- If you have smooth walls, no applied texture, use a paint pad. A <a href="//www.painters-toys.com/wooster-tru-edge-trimmer.html" target="_blank">good paint pad</a> will produce a straight line on a smooth surface with little effort.
No matter what method you try there will be the need to do a little touch-up on the ceiling. The only way to avoid this is freehand brushing with a good paint brush.