Question: vitual address to physicall address mapping happens inside kernel which has the control over the page tables.Is there any way to get the physical address corresponding to a given virtual address.?

Answer: 
You can you use `__pa(virtual_address)` macro to get physical address from a virtual address.
All physical pages are stored in the global `mem_map[page number]` and from this global you can also map physical and virtual addresses.
As well, you can try to use the `virt_to_phys()` function.
If you're talking kernel space, virt\_to\_phys() can be used.

> 
> virt\_to\_phys: The returned physical address is the physical (CPU) mapping for the memory address given. It is only valid to use this function on addresses directly mapped or allocated via kmalloc. It means It is used by the kernel to translate kernel virtual address (not user virtual address) to physical address
> 
> 
>