Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kcov, usbip: collect coverage from vhci_rx_loop

Add kcov_remote_start()/kcov_remote_stop() annotations to the
vhci_rx_loop() function, which is responsible for parsing USB/IP packets
coming into USB/IP client.

Since vhci_rx_loop() threads are spawned per vhci_hcd device instance, the
common kcov handle is used for kcov_remote_start()/stop() annotations
(see Documentation/dev-tools/kcov.rst for details). As the result kcov
can now be used to collect coverage from vhci_rx_loop() threads.

Co-developed-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Nazime Hande Harputluoglu <handeharputlu@google.com>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Link: https://lore.kernel.org/r/f8114050f8d65aa0bc801318b1db532d9f432447.1606175386.git.andreyknvl@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Nazime Hande Harputluoglu and committed by
Greg Kroah-Hartman
894f1f4f 5c8fe583

+32
+29
drivers/usb/usbip/usbip_common.h
··· 277 277 void (*reset)(struct usbip_device *); 278 278 void (*unusable)(struct usbip_device *); 279 279 } eh_ops; 280 + 281 + #ifdef CONFIG_KCOV 282 + u64 kcov_handle; 283 + #endif 280 284 }; 281 285 282 286 #define kthread_get_run(threadfn, data, namefmt, ...) \ ··· 340 336 341 337 return udev->devnum; 342 338 } 339 + 340 + #ifdef CONFIG_KCOV 341 + 342 + static inline void usbip_kcov_handle_init(struct usbip_device *ud) 343 + { 344 + ud->kcov_handle = kcov_common_handle(); 345 + } 346 + 347 + static inline void usbip_kcov_remote_start(struct usbip_device *ud) 348 + { 349 + kcov_remote_start_common(ud->kcov_handle); 350 + } 351 + 352 + static inline void usbip_kcov_remote_stop(void) 353 + { 354 + kcov_remote_stop(); 355 + } 356 + 357 + #else /* CONFIG_KCOV */ 358 + 359 + static inline void usbip_kcov_handle_init(struct usbip_device *ud) { } 360 + static inline void usbip_kcov_remote_start(struct usbip_device *ud) { } 361 + static inline void usbip_kcov_remote_stop(void) { } 362 + 363 + #endif /* CONFIG_KCOV */ 343 364 344 365 #endif /* __USBIP_COMMON_H */
+2
drivers/usb/usbip/vhci_rx.c
··· 261 261 if (usbip_event_happened(ud)) 262 262 break; 263 263 264 + usbip_kcov_remote_start(ud); 264 265 vhci_rx_pdu(ud); 266 + usbip_kcov_remote_stop(); 265 267 } 266 268 267 269 return 0;
+1
drivers/usb/usbip/vhci_sysfs.c
··· 383 383 vdev->ud.sockfd = sockfd; 384 384 vdev->ud.tcp_socket = socket; 385 385 vdev->ud.status = VDEV_ST_NOTASSIGNED; 386 + usbip_kcov_handle_init(&vdev->ud); 386 387 387 388 spin_unlock(&vdev->ud.lock); 388 389 spin_unlock_irqrestore(&vhci->lock, flags);