Knocking pipes aren't usually a serious plumbing problem, but they CAN drive you nuts!
Knocking or banging pipes can be caused by several factors; excessively high water pressure (over 55 psi), air in the water lines or a failing faucet washer. Sometimes the knocking radiates along hot water pipes from a sediment-laden water heater that is in need of flushing. However, the banging would occur at more than one faucet (not just the upstairs bathroom faucet as you describe) if the source of the problem were any of the aforementioned.
We have hunch that the knocking is caused by vibration due to a brittle or deteriorating washer. If the faucet consists of two handles, try to determine whether the knocking occurs when using "hot" or "cold" water.
Once you have narrowed it down to one or the other, close the "shut off" valve (usually in the cabinet below the faucet) and remove the decorative handle, packing nut and valve stem. The washer is attached to the bottom of the valve stem with a small screw. Remove the existing washer and replace it and reassemble the faucet in the reverse order that you took it apart.
If your faucet is a "single-lever" model, remove the handle and packing nut as you would a two-handle model. However, instead of replacing a valve stem washer, you will use a washer replacement kit.
In either case, your search for repair parts will be a lot easier if you bring the existing valve stem or single-lever "mechanism" into your hardware store for comparison.