From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FA5C433E7 for ; Mon, 19 Oct 2020 18:52:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0326223EA for ; Mon, 19 Oct 2020 18:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603133553; bh=cBZQVvUP2r7LI9yMI+VdxQxFjURUibUxsgWwchWFe/Q=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-ID:From; b=i6w4hJvRsJT4vQmieBp3pi2DDYfodL8CfuGN76kXdjvV9Y2dj8vgVJ7WgtIwfNUXS V+EwRg1ZIf1kSnrGeQvQ9kpF38+a0FaAf+mtd3M8GaC75D10pZVkqgDgG9gq3bSbnd sRzL5YCV+ijYx3gO17oXpZUXlLUIOxEPJhA7PlJI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730464AbgJSSwc (ORCPT ); Mon, 19 Oct 2020 14:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727681AbgJSSwc (ORCPT ); Mon, 19 Oct 2020 14:52:32 -0400 Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98968C0613CE for ; Mon, 19 Oct 2020 11:52:32 -0700 (PDT) Received: by mail-ot1-x344.google.com with SMTP id f37so619544otf.12 for ; Mon, 19 Oct 2020 11:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wwPRXAaMYxjFqM/YIzNWQCJWcq2FDVHsw8/2EBq/9VU=; b=QXyH1Uoh0HaPVS3ogACUfZSrONjtnanEi7sYkrOLGnRqNeDWL0KFCnPyRn4EDO091X gCFc2qpmlsYMAORzxra1AkYBosy1H29fHnn3M3o1wgkDOYQ58pTQ4sZg+aiqsI4YxZru Rt085B2812Ju/Od92PjjFINlzvZn7chwiyltU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wwPRXAaMYxjFqM/YIzNWQCJWcq2FDVHsw8/2EBq/9VU=; b=k8PKnaMiB6/h2LetyR+6f69emTWbljjJRulywf8MSMavveT+mfYnOpPC0dSOKwJxvX STbKwXfvMqd1AjJKN1zZDHDj6uqkc5VztEhiQP9oPwDFQOlgxvR32AzwOtT0x1vMbE6f YL9Dyk4l4XKLwSCOqFU182hFuRehtsTibPir2geh/J4eGtUTSuap9Q2FMij+bJZX37D8 k7yWhn8ByGX8hKkqqpOX8IpViAbYLtnjkdOFcZ3/DQIiq6THB5GLeUABBLDB5ifG/vY2 MJ1YBhNSN03O+N4714FAyVX77Ock3IVy+AIrrOIqWf04Cv/hFXFOWY4Dj7JADJwMQQTV xx/g== X-Gm-Message-State: AOAM531YqItKhYnQMbyDsaj0Gh1Bskq18mGQ1eoozkALElpSzK+WvMwx 52/ZaXwyMWkFB3wGQNNKM2N7Pg== X-Google-Smtp-Source: ABdhPJzdSd2LvaOxu/5mKLj3tQrTLEdoRYuVpFdhu/ztrTOVEnY3w1zEPrR9+Jpu4jkJD8gDRtkUJA== X-Received: by 2002:a05:6830:19d9:: with SMTP id p25mr997145otp.135.1603133551820; Mon, 19 Oct 2020 11:52:31 -0700 (PDT) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x15sm201142oor.33.2020.10.19.11.52.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Oct 2020 11:52:31 -0700 (PDT) Subject: Re: [PATCH v3] kcov, usbip: collect coverage from vhci_rx_loop To: Andrey Konovalov , Shuah Khan Cc: Dmitry Vyukov , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Alexander Potapenko , Marco Elver , Aleksandr Nogikh , Nazime Hande Harputluoglu , Nazime Hande Harputluoglu , Shuah Khan References: From: Shuah Khan Message-ID: <2ee45dd7-0735-fcbb-545c-352d9c5d8689@linuxfoundation.org> Date: Mon, 19 Oct 2020 12:52:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On 10/19/20 12:49 PM, Shuah Khan wrote: > On 10/19/20 11:20 AM, Andrey Konovalov wrote: >> From: Nazime Hande Harputluoglu >> >> 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. >> >> Signed-off-by: Nazime Hande Harputluoglu >> Signed-off-by: Andrey Konovalov >> --- >> >> Changes v2->v3: >> - Fix build without KCOV enabled. >> >> --- >>   drivers/usb/usbip/usbip_common.h | 4 ++++ >>   drivers/usb/usbip/vhci_rx.c      | 7 +++++++ >>   drivers/usb/usbip/vhci_sysfs.c   | 4 ++++ >>   3 files changed, 15 insertions(+) >> >> diff --git a/drivers/usb/usbip/usbip_common.h >> b/drivers/usb/usbip/usbip_common.h >> index 8be857a4fa13..0906182011d6 100644 >> --- a/drivers/usb/usbip/usbip_common.h >> +++ b/drivers/usb/usbip/usbip_common.h >> @@ -277,6 +277,10 @@ struct usbip_device { >>           void (*reset)(struct usbip_device *); >>           void (*unusable)(struct usbip_device *); >>       } eh_ops; >> + >> +#ifdef CONFIG_KCOV >> +    u64 kcov_handle; >> +#endif >>   }; >>   #define kthread_get_run(threadfn, data, namefmt, ...)               \ >> diff --git a/drivers/usb/usbip/vhci_rx.c b/drivers/usb/usbip/vhci_rx.c >> index 266024cbb64f..68ec0aa64f69 100644 >> --- a/drivers/usb/usbip/vhci_rx.c >> +++ b/drivers/usb/usbip/vhci_rx.c >> @@ -3,6 +3,7 @@ >>    * Copyright (C) 2003-2008 Takahiro Hirofuchi >>    */ >> +#include >>   #include >>   #include >> @@ -261,7 +262,13 @@ int vhci_rx_loop(void *data) >>           if (usbip_event_happened(ud)) >>               break; >> +#ifdef CONFIG_KCOV >> +        kcov_remote_start_common(ud->kcov_handle); >> +#endif >>           vhci_rx_pdu(ud); >> +#ifdef CONFIG_KCOV >> +        kcov_remote_stop(); >> +#endif >>       } > > Let's move these into usbip_common.h as inline functions along > the line of > > #ifdef CONFIG_KCOV > usbip_kcov_remote_start_common(ud) > { >   kcov_remote_start_common(ud->kcov_handle); > } > > usbip_kcov_remote_stop_common(ud) > { >   kcov_remote_stop_common(ud->kcov_handle); > } > #else > stubs that do nothing > #endif > >>       return 0; >> diff --git a/drivers/usb/usbip/vhci_sysfs.c >> b/drivers/usb/usbip/vhci_sysfs.c >> index be37aec250c2..e167b8a445ad 100644 >> --- a/drivers/usb/usbip/vhci_sysfs.c >> +++ b/drivers/usb/usbip/vhci_sysfs.c >> @@ -4,6 +4,7 @@ >>    * Copyright (C) 2015-2016 Nobuo Iwata >>    */ >> +#include >>   #include >>   #include >>   #include >> @@ -383,6 +384,9 @@ static ssize_t attach_store(struct device *dev, >> struct device_attribute *attr, >>       vdev->ud.sockfd     = sockfd; >>       vdev->ud.tcp_socket = socket; >>       vdev->ud.status     = VDEV_ST_NOTASSIGNED; >> +#ifdef CONFIG_KCOV >> +    vdev->ud.kcov_handle = kcov_common_handle(); >> +#endif > > > Same here add a usbip_kcov_handle_init(ud) > btw - I am seeing bounces on handeharputlu@google.com address. thanks, -- Shuah