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=unavailable 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 53F3BC43457 for ; Tue, 13 Oct 2020 17:28:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB46F25356 for ; Tue, 13 Oct 2020 17:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602610094; bh=1/Kdcv9eqOOIOcBN6PGfdkAoeZTGhsqwBqCh1LXU3oI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-ID:From; b=F5mhitYbsquXFl1phRIrMM9t6Kl5nv5OWOI7QQJ10DQDIng4iydWp1MiMc+NwjKs2 MoGYh3TPjmfByWrHhOo5Lwd2UDOhnWy+p9YY/dZdhQrnFjOl8fz/UmGbcwY0OFs/1u yF8o0d+tzMVb7KKy0z0MDMC/oHt8Z2lQE6MFGFmY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730123AbgJMR2M (ORCPT ); Tue, 13 Oct 2020 13:28:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727153AbgJMR2L (ORCPT ); Tue, 13 Oct 2020 13:28:11 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44358C0613D2 for ; Tue, 13 Oct 2020 10:28:10 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id y20so227486iod.5 for ; Tue, 13 Oct 2020 10:28:10 -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=R/AMQsx5esXhv7hCeHiqsScS6XgaG02ARXQXpgNkGiA=; b=b+l2lCOQXhSJNUVZjanJDDfs5sRSa4KyaE4FH6pYvEukVWR4yiiCwBmhRaydp/jOrT 43sHtKek3HH0nTZNecXQYWj+S4GuNuJ8GnTA3IaeURFcpO3td+xMy1ueIU4/jO5FnE6I dEou+rouTK1mby3cy/9Iv60qWfg7xBLywvRhs= 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=R/AMQsx5esXhv7hCeHiqsScS6XgaG02ARXQXpgNkGiA=; b=s7iCAVrje5hl58S0UywL4zbG3UldGXYFi9yskTA24oEeZHadXF+op8zBF82BfNa3tw DGONCTAlApJ1WP5If0SlSxS4lKzJ4PCXfXjKOTkqCspMKxFJecCS3NV3bDxAeZTFEjuM b5g+xytvV0RVLK0wrhsdYpT4PsQ5hfX79VWSF+oy7lwRmI9Q+JptYg5bMUukESZ6VQLB fjR2KoYkvxAgOfPexV4OMMrzPD9ojEozBHt2O+wZ5OxcFh44eHIhKckM2EHNhrNyh7SQ /805RrVYNfTeffD3/lB6YU8xnh0zZoxivJQTIqw9uR162NAN32K0Oxto9FcBbXGb0hKm VcWQ== X-Gm-Message-State: AOAM530KIfzH5Z/x5LG/Pmq+4BpuUhAnmzx0XqJh1UDUAzPqg6DMX45c F6vuxmA9PQ1X594dTbvuDPd/VVqy5pmUpQ== X-Google-Smtp-Source: ABdhPJzM55OqjIgPRT84zPcP04/nSWHIJEFjqF3/7YdjUq6aAQkyNI/67/rpIEpNw6j4THgR+qMouA== X-Received: by 2002:a02:a90c:: with SMTP id n12mr882247jam.102.1602610089502; Tue, 13 Oct 2020 10:28:09 -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 a86sm449535ill.11.2020.10.13.10.28.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Oct 2020 10:28:08 -0700 (PDT) Subject: Re: [PATCH v2] kcov, usbip: collect coverage from vhci_rx_loop To: Andrey Konovalov , Dmitry Vyukov , Greg Kroah-Hartman Cc: Andrew Morton , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Alan Stern , Shuah Khan , Alexander Potapenko , Marco Elver , Aleksandr Nogikh , Nazime Hande Harputluoglu , Nazime Hande Harputluoglu , Shuah Khan References: From: Shuah Khan Message-ID: Date: Tue, 13 Oct 2020 11:28:07 -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: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On 10/12/20 11:10 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 > --- > > Changes v1->v2: > - Fix spacing issues. > - Add ifdef CONFIG_KCOV around kcov_handle in usbip_device struct. > Does this compile without CONFIG_KCOV? > --- > drivers/usb/usbip/usbip_common.h | 4 ++++ > drivers/usb/usbip/vhci_rx.c | 3 +++ > drivers/usb/usbip/vhci_sysfs.c | 12 +++++++----- > 3 files changed, 14 insertions(+), 5 deletions(-) > > 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..473f14587bd5 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,9 @@ int vhci_rx_loop(void *data) > if (usbip_event_happened(ud)) > break; > > + kcov_remote_start_common(ud->kcov_handle); You are referencing kcov_handle defined in CONFIG_KCOV scope here. Does this compile for you without CONFIG_KCOV? > vhci_rx_pdu(ud); > + kcov_remote_stop(); > } > > return 0; > diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c > index be37aec250c2..966f1f5cafb1 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 > @@ -378,11 +379,12 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr, > dev_info(dev, "devid(%u) speed(%u) speed_str(%s)\n", > devid, speed, usb_speed_string(speed)); > > - vdev->devid = devid; > - vdev->speed = speed; > - vdev->ud.sockfd = sockfd; > - vdev->ud.tcp_socket = socket; > - vdev->ud.status = VDEV_ST_NOTASSIGNED; > + vdev->devid = devid; > + vdev->speed = speed; > + vdev->ud.sockfd = sockfd; > + vdev->ud.tcp_socket = socket; > + vdev->ud.status = VDEV_ST_NOTASSIGNED; > + vdev->ud.kcov_handle = kcov_common_handle(); Don't change spacing for other variables. Add just the new code. Don't you need CONFIG_KCOV around this new code? > > spin_unlock(&vdev->ud.lock); > spin_unlock_irqrestore(&vhci->lock, flags); > thanks, -- Shuah