Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp619380rwb; Tue, 25 Jul 2023 23:19:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjbt8XMp77E/ok4+VPXfdDNYbkMguPBJPUTpuomNcQqWbuQu2ezstvR0qUUl1GkkWQlKTd X-Received: by 2002:a05:6a20:12c3:b0:137:514a:9835 with SMTP id v3-20020a056a2012c300b00137514a9835mr1114618pzg.9.1690352376634; Tue, 25 Jul 2023 23:19:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690352376; cv=none; d=google.com; s=arc-20160816; b=fiUaFuzkWfazg1e6qguR3r/Irtkxy32VlqhkYiDcC37Hdo8X5jtzrixGnsQGolSJLf VZ6HNWKvR7z2S2SKlojq3dyt/SU3lcfcwGnf2hw9TZp8fNZSZ7LI+/Rmgf4dJrsSxIo7 RBtPbKZnutTQCDi17Ap3Tfm/KYVyrSy8mDYWxEp2wkZIDun72h5QmW+ZQP8dblAhDpMW xcKJwQsUkBhdsFbF1j7yMIzqY8l7tgMWRO2IFFWCahdJ5qPsqIwRK/Nrl42OAxxZYEs/ hdWYJ8XGEjYDeujHBtVurWXqqFBTsiRCNI8FASB4Z4QJmlSTgWagPt/AjbK5gwv2IZ+j dicg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=pfs3nnD/SOOUA7MFV9W94hwiVWoxJiHiqbutUMOkKZQ=; fh=VtnxsSJ8LXQI/oWyxzk1S8ltpk+0QRW/lgxQ5nGspv0=; b=YW2u9+nNT6QbIQSzKFtIL1RazOl/6CGgEZhS743GuUoL05GIdTCoP+yLfLs2vRzWIA Jc12abP+SDs5QWn4XGtITCcQlKBfkbF5y6JY+31hkh3lRx6L/v5/OYQaGLb2V5iC1IUZ vQ64BKgC23IrwlPUWoeTr+zi0saTlBEOuWsnNGw5QuQydvvll241kcP/rnXTVReknDpe vQmbBB4Pu3k1N6RysESxrPtmxYQOXaO4h5qZI9ymSSYj+bD53ZH6nL4RRT0rcMSrnGkb n5LTroFCl535E+xBe5/E3eEoyDZSW3f3l9Yh9I9Ro/o4TkYltYwZFXBkmkcBwFIBdDFc Noqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E81W2JoP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a17090311d100b001b8690d7181si13142134plh.550.2023.07.25.23.19.24; Tue, 25 Jul 2023 23:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E81W2JoP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231321AbjGZFj2 (ORCPT + 99 others); Wed, 26 Jul 2023 01:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbjGZFj1 (ORCPT ); Wed, 26 Jul 2023 01:39:27 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2B822693 for ; Tue, 25 Jul 2023 22:38:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690349917; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pfs3nnD/SOOUA7MFV9W94hwiVWoxJiHiqbutUMOkKZQ=; b=E81W2JoPqXZoVdmZWJQZTBzCOtCD9bksmEy1OmktNnXJ0ry8DW7oGBtVGp7FnEOx3u0p/E hM76DEL06Wq5sFTNsIIGAc67meSTKUoi2E2anUag//TAGXpVCZnP6SZ+v7PHoPNtb1GKQa rD+HrR6UdUc368CdE/2cEvEYrvawZxg= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-gThW64d1ORyqJT9XQdyKhQ-1; Wed, 26 Jul 2023 01:38:36 -0400 X-MC-Unique: gThW64d1ORyqJT9XQdyKhQ-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2b9b820c94fso1848591fa.2 for ; Tue, 25 Jul 2023 22:38:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690349915; x=1690954715; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pfs3nnD/SOOUA7MFV9W94hwiVWoxJiHiqbutUMOkKZQ=; b=L+a1OYQQS49ivoX1rxa5eREDv/WX6qMOrHRUF22oYTCtR2pGBGJp54Czik4O5fmCpL JcU+EzCHQVYQ38eI16jy8GuPZ04Y2xMcCeHeDpzjyI6N2WHolXCQG7c27wYq2Nz/RnWu iIeiCcXtAUTlrFjRvqQ1D/PcXa5THCRIk8DsVPVq4bopdieouUF/F7x/LGxSKKDSb7Z+ e9q4qvk9jEu422CHCmfqQN3rQ2V0tbQJnOX05bubhdfuOxo9RI2jE7SbS9u8gXenX1mf nVRw6dhmrDcSbnV23RuYMt08mNGyvaLVOfgE7JMULsbZas/y2ee4DgrM+Z+CWQ4H9HSm dDYQ== X-Gm-Message-State: ABy/qLbXBR0/e1OS+tzJ3oxoDF/LmPmHe3MxVEmhYZ65UzHbx2/knSEL A058yLyXywSwNTBLWul3GcON05H/rAWeML14fdDr3LB4C29jj8E8T6oedifSFrRZEsI/JKGJ1vz uOCxah36s5+VEPIDY2A76v2egR+2w7s4YQxP2orhJ X-Received: by 2002:a2e:8042:0:b0:2b6:dd9a:e1d3 with SMTP id p2-20020a2e8042000000b002b6dd9ae1d3mr605685ljg.44.1690349914783; Tue, 25 Jul 2023 22:38:34 -0700 (PDT) X-Received: by 2002:a2e:8042:0:b0:2b6:dd9a:e1d3 with SMTP id p2-20020a2e8042000000b002b6dd9ae1d3mr605673ljg.44.1690349914469; Tue, 25 Jul 2023 22:38:34 -0700 (PDT) MIME-Version: 1.0 References: <20230705114505.63274-1-maxime.coquelin@redhat.com> In-Reply-To: <20230705114505.63274-1-maxime.coquelin@redhat.com> From: Jason Wang Date: Wed, 26 Jul 2023 13:38:22 +0800 Message-ID: Subject: Re: [PATCH] vduse: Use proper spinlock for IRQ injection To: Maxime Coquelin Cc: xieyongji@bytedance.com, mst@redhat.com, david.marchand@redhat.com, lulu@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, xuanzhuo@linux.alibaba.com, eperezma@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 5, 2023 at 7:45=E2=80=AFPM Maxime Coquelin wrote: > > The IRQ injection work used spin_lock_irq() to protect the > scheduling of the softirq, but spin_lock_bh() should be > used. > > With spin_lock_irq(), we noticed delay of more than 6 > seconds between the time a NAPI polling work is scheduled > and the time it is executed. > > Fixes: c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace") > Cc: xieyongji@bytedance.com > > Suggested-by: Jason Wang > Signed-off-by: Maxime Coquelin Acked-by: Jason Wang Thanks > --- > drivers/vdpa/vdpa_user/vduse_dev.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/= vduse_dev.c > index dc38ed21319d..df7869537ef1 100644 > --- a/drivers/vdpa/vdpa_user/vduse_dev.c > +++ b/drivers/vdpa/vdpa_user/vduse_dev.c > @@ -935,10 +935,10 @@ static void vduse_dev_irq_inject(struct work_struct= *work) > { > struct vduse_dev *dev =3D container_of(work, struct vduse_dev, in= ject); > > - spin_lock_irq(&dev->irq_lock); > + spin_lock_bh(&dev->irq_lock); > if (dev->config_cb.callback) > dev->config_cb.callback(dev->config_cb.private); > - spin_unlock_irq(&dev->irq_lock); > + spin_unlock_bh(&dev->irq_lock); > } > > static void vduse_vq_irq_inject(struct work_struct *work) > @@ -946,10 +946,10 @@ static void vduse_vq_irq_inject(struct work_struct = *work) > struct vduse_virtqueue *vq =3D container_of(work, > struct vduse_virtqueue, inject); > > - spin_lock_irq(&vq->irq_lock); > + spin_lock_bh(&vq->irq_lock); > if (vq->ready && vq->cb.callback) > vq->cb.callback(vq->cb.private); > - spin_unlock_irq(&vq->irq_lock); > + spin_unlock_bh(&vq->irq_lock); > } > > static bool vduse_vq_signal_irqfd(struct vduse_virtqueue *vq) > -- > 2.41.0 >