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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 7F656C07E9A for ; Wed, 14 Jul 2021 05:55:12 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 368DF613AA for ; Wed, 14 Jul 2021 05:55:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 368DF613AA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 019E7402F1; Wed, 14 Jul 2021 05:55:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0LHWDCZRn-u3; Wed, 14 Jul 2021 05:55:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8CEFA4029A; Wed, 14 Jul 2021 05:55:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 64035C001A; Wed, 14 Jul 2021 05:55:10 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4FDE0C000E for ; Wed, 14 Jul 2021 05:55:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3E00B60A6C for ; Wed, 14 Jul 2021 05:55:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3mX65Gy1kcFG for ; Wed, 14 Jul 2021 05:55:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 93410606B6 for ; Wed, 14 Jul 2021 05:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626242106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vuixl4fC2c2rDMK0JnG+CP570kUeJWSiqn18LVKWU/A=; b=ZHrCj9J5MiywYvEk8JK/z4/yFpt1l+XKqoY6dGbaLpa+fSnC7apgZseNeUrYmm2i05eAWD 7tOWoNXlPf+2tsY42Rl2sdt6vtj6SSVl6Gslc7363MqC3JxJHTDcYYUJAnG6twGCcdKfHZ a3AeLSCnXI4XsIYY2BrHTHE2XKeXIjQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-aFZ8W0BDPxu2oKzFVpVl2g-1; Wed, 14 Jul 2021 01:55:05 -0400 X-MC-Unique: aFZ8W0BDPxu2oKzFVpVl2g-1 Received: by mail-wr1-f69.google.com with SMTP id m9-20020a5d4a090000b029013e2b4a9d1eso914655wrq.4 for ; Tue, 13 Jul 2021 22:55:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vuixl4fC2c2rDMK0JnG+CP570kUeJWSiqn18LVKWU/A=; b=uYI0AbxlGgX7iyHer/Ayn2RjQCndGj2TylH0jsgXmpn/wr52gCyDN9hDaFwiUqdotO /SxpuNyEXBuTcyizbnL2WkKCXsv0x1n/t5EMk6EATJFtfDYkqkqUXxgkw85E3ltWiikc medJmiEzsCzzLddvaymGDqtFmEusMivZsA+/7+8GI3I+soy371SeB0XMh3punOPIQuBe Qbm09Ku3l60QtdwWj7DAMMe7w9anbnNy5oIwoTm1fxoMuYTop+4I/KH13Oa5Dpho6/p8 SNZTamNmU3HCMFcpxCzPLaUrAOMhzVaskoycAdbTec1pPcVL3c8EaY2C39rpr+5wHlvq uzQg== X-Gm-Message-State: AOAM530X5i1uyHC0MZ3TK3Y68wid4fY60/AsfXgktYxmV2hZTk119QtM l06lx5bWCqkNmkFl1F7namKupf6NkVuL1m+dO3xrsjI/rXRDVT90Ah0GKtnSKVSKlQmSYd4M2vF 7usBRQrIlZmEd4iipH0jsqzu2gTDMwAy6VOGEjKEGqA== X-Received: by 2002:a7b:c3c1:: with SMTP id t1mr8958234wmj.25.1626242103971; Tue, 13 Jul 2021 22:55:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/S4q9eTkg2SYhF6yFeKAyfrn1SBCErVUzbnkOz4rD7u4lWIEWYF5U7IkZ57PnxEN5PdQimQ== X-Received: by 2002:a7b:c3c1:: with SMTP id t1mr8958222wmj.25.1626242103823; Tue, 13 Jul 2021 22:55:03 -0700 (PDT) Received: from redhat.com ([2.55.15.23]) by smtp.gmail.com with ESMTPSA id i15sm1182300wro.3.2021.07.13.22.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 22:55:03 -0700 (PDT) Date: Wed, 14 Jul 2021 01:54:58 -0400 From: "Michael S. Tsirkin" To: Jason Wang Subject: Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace Message-ID: <20210714014817-mutt-send-email-mst@kernel.org> References: <20210713084656.232-1-xieyongji@bytedance.com> <20210713084656.232-17-xieyongji@bytedance.com> <26116714-f485-eeab-4939-71c4c10c30de@redhat.com> MIME-Version: 1.0 In-Reply-To: <26116714-f485-eeab-4939-71c4c10c30de@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, christian.brauner@canonical.com, corbet@lwn.net, joro@8bytes.org, willy@infradead.org, hch@infradead.org, Xie Yongji , dan.carpenter@oracle.com, xiaodong.liu@intel.com, viro@zeniv.linux.org.uk, stefanha@redhat.com, songmuchun@bytedance.com, axboe@kernel.dk, zhe.he@windriver.com, gregkh@linuxfoundation.org, rdunlap@infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, bcrl@kvack.org, netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, mika.penttila@nextfour.com X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Wed, Jul 14, 2021 at 01:45:39PM +0800, Jason Wang wrote: > > +static int vduse_dev_msg_sync(struct vduse_dev *dev, > > + struct vduse_dev_msg *msg) > > +{ > > + int ret; > > + > > + init_waitqueue_head(&msg->waitq); > > + spin_lock(&dev->msg_lock); > > + msg->req.request_id = dev->msg_unique++; > > + vduse_enqueue_msg(&dev->send_list, msg); > > + wake_up(&dev->waitq); > > + spin_unlock(&dev->msg_lock); > > + > > + wait_event_killable_timeout(msg->waitq, msg->completed, > > + VDUSE_REQUEST_TIMEOUT * HZ); > > + spin_lock(&dev->msg_lock); > > + if (!msg->completed) { > > + list_del(&msg->list); > > + msg->resp.result = VDUSE_REQ_RESULT_FAILED; > > + } > > + ret = (msg->resp.result == VDUSE_REQ_RESULT_OK) ? 0 : -EIO; > > > I think we should mark the device as malfunction when there is a timeout and > forbid any userspace operations except for the destroy aftwards for safety. This looks like if one tried to run gdb on the program the behaviour will change completely because kernel wants it to respond within specific time. Looks like a receipe for heisenbugs. Let's not build interfaces with arbitrary timeouts like that. Interruptible wait exists for this very reason. Let userspace have its own code to set and use timers. This does mean that userspace will likely have to change a bit to support this driver, such is life. -- MST _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization