From patchwork Mon Feb 12 17:16:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 199944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp60338dyb; Mon, 12 Feb 2024 09:25:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVR2f7epDioTSxt/2QOgqrexotYnwVSo8USHk/XeeEWnckkdMPCXpKj5Vw/Q5MxWSEuHhPmcPgax6um9JV7TFHK+KRxZQ== X-Google-Smtp-Source: AGHT+IHPO4rCQWWZm3n8Ch+faRzm63DkjgDF+0326bWzHK/vPjkH/ATEuk/YUAy6pGL1gyS0es7I X-Received: by 2002:a17:90b:4d90:b0:297:130b:190 with SMTP id oj16-20020a17090b4d9000b00297130b0190mr4510347pjb.36.1707758759702; Mon, 12 Feb 2024 09:25:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707758759; cv=pass; d=google.com; s=arc-20160816; b=RClcGp9+lObch81A3v6aUTjrAFkCIylyICyaHkxuKhlw58qf9JG3ybNV/9y9XEEKZn c89JrkW+FJ1ZmM/ZjSHiTD1VuHPst6EIQso063JxD5ga261mNw3OJZidXiLwmBMP8gCH ygDONYY1MzPCQz53qhFpiLcuMubJGGRUJvLdqbIb1XvJMGE84gOzysl1+1pmkJP9NbiG Brb/dclhZR/GhvTWYkmOKyGgYQULOB5wZKEsm96OemvcKpa6nAuoa9aehQdVW8szjOK2 EEuTKRL+JNL2JinJG1rdQbxi8jPqRNwwQbXJW+b3UzQ01wxUaviSlAVK4x2xAbU2J//V 6Crw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=z8GvELFSi4mPAmel/pOmBem7/ZTWt0q7f0l9+QlF1TI=; fh=Sjzvox9CDi/Et6LaNnSlw9jN/X7zMIp/mWUUfFLPhds=; b=0ieOVUSIwpiPqL1HB7MFxwHBxAMjBGQeJildIsVfCSnszBRj0Kc4buAhIG63PwwfiO LvxlpKbSK7cMKBXxNlNtsPMbPSpEDxkOPhWrZ4TldwkG2KCjihhEPvjEdZcV38ncNDvr 23Atk5kQq46LD2YzejkX6fPwA9KhVegodr3hij6ZHxE1STPYZL/VG0QiQkCnzk5HNUaO 1CVFwx5/D/Vcqq/TctxmvqvNL0SgneD5QNuRXfFxpRIA/cncdh2LJE/oDGQPvEZf3mGQ 6WzazoEIfO8qATyz9HIqMYk+2IBUxVijcZiqIVjyXRtCLdt403jliBPsYeU2+JCD+bOs W87g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=Xj3o1k5l; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-62078-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62078-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com X-Forwarded-Encrypted: i=2; AJvYcCUJoQm6eAvuWFBeHTJeCnloILTR/jyJhTMwPGQh141B+WEsnOUZZepPGHCSzyB2w+Zq6TrSRAoOJ6kXAx/A6sUX1VcSLw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id v3-20020a17090abb8300b00295dcfa67b3si556851pjr.183.2024.02.12.09.25.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:25:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62078-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=Xj3o1k5l; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-62078-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62078-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9E1CC28A82E for ; Mon, 12 Feb 2024 17:17:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 517CC3FB0A; Mon, 12 Feb 2024 17:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="Xj3o1k5l" Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E17953F8E6 for ; Mon, 12 Feb 2024 17:16:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.165.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707758192; cv=none; b=Kxn0wpaXsoEd7MT/o5vemINW60pp9flJ/M5dZ8YR3I05DWKgUripF3rVFbSeP0hMUruM0JC68Xam9SZZLg7hLeX3yeddcWbgcBD8+JQOG3YK+iWHYZ/wsME0lZaNS9RhTEchB0/ZtP2iz0UNu6uO3s6UNpTrj+j8IjYqA14ZHms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707758192; c=relaxed/simple; bh=lKOoSfquQ5BHu7gGPJmq/4K7O6V6JxFx1vc1Dz1AbPE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UaUkzWMyKC3y48PHD4im9Ae7VNGSRj+L6UnyaMhEFFX+3KfPGFdw1Co2FUGq1PHW/3ZcVOJxVfQMxupTBOF3s8uOMTC2lDFQifP+GUXXKNaDQaiw3+ftJ2Y/BYuHFlkXnEdsi9GO6MK+MoIIO3yi6iEADZBm9NRHXyWTqGUUuwU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=Xj3o1k5l; arc=none smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41CGfroU006118; Mon, 12 Feb 2024 17:16:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=z8GvELFSi4mPAmel/pOmBem7/ZTWt0q7f0l9+QlF1TI=; b=Xj3o1k5lw0ACxxscwFQ9znTd2gThmj55+a0xwMZlA7s8ugCvocYX/9WjaJYwqwabFgOv W9BPy32rEvJKloMMQMYt7fZUaqXJXncVmyr/BvmeIiUc1KymdN7EPT7UoTp6tt4abKPn j56T97bqP7viDDHa2cVPDi2J0EtsmM6XBeQBU7jp17uSPfQRCnpSQk8ZxuSHANmeXEcl joFeooAj/ndpLWL6R+tMBJSUFMr6B2xYGTSw6SbiOfwePmxNdQB0Tsj93sZXtVOyqrq/ 2aRm+35EgXvNfsQCwr+5uX/9ZyQy3EhsY8pMV0UjyPWRdliep2hf3DdAZu1lI90s7HGw GA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w7q2y030b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:16:18 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41CGaHwX031332; Mon, 12 Feb 2024 17:16:17 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5yk620ej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:16:17 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41CHGFCA019216; Mon, 12 Feb 2024 17:16:17 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3w5yk620cq-2; Mon, 12 Feb 2024 17:16:17 +0000 From: Steve Sistare To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Jason Wang , Si-Wei Liu , Eugenio Perez Martin , Xie Yongji , Stefano Garzarella , Steve Sistare Subject: [PATCH V2 1/3] vhost-vdpa: flush workers on suspend Date: Mon, 12 Feb 2024 09:16:12 -0800 Message-Id: <1707758174-142161-2-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707758174-142161-1-git-send-email-steven.sistare@oracle.com> References: <1707758174-142161-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_14,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402120131 X-Proofpoint-ORIG-GUID: c--00v5-y9I_0B3lmrLq1lXsXSRP_zgm X-Proofpoint-GUID: c--00v5-y9I_0B3lmrLq1lXsXSRP_zgm Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790714849284582874 X-GMAIL-MSGID: 1790714849284582874 Flush to guarantee no workers are running when suspend returns. Signed-off-by: Steve Sistare Acked-by: Eugenio PĂ©rez --- drivers/vhost/vdpa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index bc4a51e4638b..a3b986c24805 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -594,10 +594,13 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v) struct vdpa_device *vdpa = v->vdpa; const struct vdpa_config_ops *ops = vdpa->config; int ret; + struct vhost_dev *vdev = &v->vdev; if (!ops->suspend) return -EOPNOTSUPP; + vhost_dev_flush(vdev); + ret = ops->suspend(vdpa); if (!ret) v->suspended = true; From patchwork Mon Feb 12 17:16:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 199941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp57453dyb; Mon, 12 Feb 2024 09:20:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEY2q0x0Is3uQ4PvfbWqgHahpfTS2u5cyts/VM84lf833HbJo4C2Mn8l3DAnGJauxz+l2Q5 X-Received: by 2002:aa7:ccd4:0:b0:560:b488:d9bd with SMTP id y20-20020aa7ccd4000000b00560b488d9bdmr5193539edt.8.1707758436823; Mon, 12 Feb 2024 09:20:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707758436; cv=pass; d=google.com; s=arc-20160816; b=YJTt+5p0PzinIhuppZjjUwOAbNbBpjns1FmW/pZsOfX+GBNi4b4GkSUI+XutZfzEBP Wsf5aqUj34WzP9AJr0znsb2qo+FbNp/21sDQ+H72VGhtsOaITlqo5PVT4C7gQTIacSLB u+fMMUsOOXCWGQZDmKHKEbStvvZEWp+zjwM/pn3SW2BsKyJypp7DcFekU3Gbj2lTPKV6 1U0Bylvs8Dl51VXBf69c77IUQPTRVl40Xm+nikdobICPp9b+wcn1QHneILARifJHPlCq f3Hg/VbdR6udq6xFQ9LoWSCQvNLHkH+DH0CYaNVlhHVRnnrOFIL/xLNSTTFGYNxqPj+h QVoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=2Q4si0x3nG3VI9xSasdsfLDFx2lasKaM6lvaVLjk0wk=; fh=/HkVZxpY6l+68Bf/Ow6uX6wt9AsiQQhXCb92f3KmY60=; b=pP/sdgtOCIpppI4E48Mo9vS8r7zP9D9e63stcAmKOsZcOZ/NhQRVQsWutgHR+ExyNM BZ8po5Zvtnym2LoIzHazw/2/XWG6YdhSI3LiFRiV4gO7heKVbTsBpJX7yCnb/oQtGbtL WfGNlnF/0VuJHd4wOQCe92Jc1zTrEEFd0Xq+V/fkoySpGDq0Indv/EowMFBvPVTLpg6V DVKfdLE1DSciLo1GiiNuvYRDcD1lMQiTjyidUf/6HFjkftCYA8dGuzgmK9ddu/1CCVLM UBNlHHb5+ELh/fcKuZyj4w2aZT58KLeBnRxddDV3k8rKALKGVnlJ+VXCMGOSSzO7xloq +EKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=BnTgIY95; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-62081-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62081-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com X-Forwarded-Encrypted: i=2; AJvYcCX2aYUeRMl9+uD3vUVjePidfwQMFioYNLY9fGGqeI1wxQmjiOfVC3QQuU7CDn+c0XJfXMI+3Md6QrIIuOMo/bfZ1XAYCw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h7-20020a056402280700b00561d2a8b038si514683ede.593.2024.02.12.09.20.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:20:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62081-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=BnTgIY95; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-62081-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62081-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7D4F21F2B5CF for ; Mon, 12 Feb 2024 17:17:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02C7640C04; Mon, 12 Feb 2024 17:16:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BnTgIY95" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80F653FB1C for ; Mon, 12 Feb 2024 17:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707758197; cv=none; b=X6jvWpnRZ4WUMCY1BfCabVLP29oIXCLurGJFWdzT0BhXQWWREJeqSD2tngBZUkCk/pPbXDE3Res0TQBw9Bo4PUlJgNDswIH6dg/HCYSkgEMXi10BHQPJFALLE8oWIjO3o4RTjL6+lgUYH7h+u9qdLT3F7eMSCmRxA+7uMvfiWg8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707758197; c=relaxed/simple; bh=Q6Yq07+VdvdKRo4K3In05WZjYT3GiDeEF2bQ46jl/XU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=sY1LNApNY87P8S0oYLesOnvv7BYR1dV0THLLgP3JRx5tkjQyfFswT4ytUqQJTQSyA9WE6DG0oe3oN6P0ljK1m/a1JQNGfVMJvn9GdcOLI96cU9TGDsRzgqp5dyspoXA/iDtaWPlz8Fa0LnAmFmY3dVO8FTU1mVyVN0O83nrh9Lo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=BnTgIY95; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41CFxpIS004867; Mon, 12 Feb 2024 17:16:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=2Q4si0x3nG3VI9xSasdsfLDFx2lasKaM6lvaVLjk0wk=; b=BnTgIY95wjHStu21zgmfSgXIo9yUC3WUxQN1MJw0Wc0n4UP5jsS8Y6fsIO6iZhyBIP2m hxSVSp6lj5Lsn6OvvMlv88XBEYc0NjBSGTsCgRp7Gqbkgk514Dw0s0Xf/5P9IIRtGx9Y lOPyBce85Dok6vo2o7pbmxIH4SZ8W78lvBTqJ/BmvKD5SF5esStfOqWnY4ml73IFvSu/ oTNgfPA+dk1uydQetedhaLRtKKxkdxJH13DoL34tqugF1hk0q5j7ADSzCo3lUAydyjdA XuCdVyy/au597x4y7DX/NgGQLuQMgc8tBUeA/h2c4dtzvTwVYM+ZCnHSwlgoxbWXjz3N 4Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w7pf1r6yf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:16:19 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41CGZllm031499; Mon, 12 Feb 2024 17:16:18 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5yk620f9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:16:18 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41CHGFCC019216; Mon, 12 Feb 2024 17:16:18 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3w5yk620cq-3; Mon, 12 Feb 2024 17:16:18 +0000 From: Steve Sistare To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Jason Wang , Si-Wei Liu , Eugenio Perez Martin , Xie Yongji , Stefano Garzarella , Steve Sistare Subject: [PATCH V2 2/3] vduse: suspend Date: Mon, 12 Feb 2024 09:16:13 -0800 Message-Id: <1707758174-142161-3-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707758174-142161-1-git-send-email-steven.sistare@oracle.com> References: <1707758174-142161-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_14,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402120131 X-Proofpoint-ORIG-GUID: 52OpQkWopH_UijR_V1gH72otsGZlCUqw X-Proofpoint-GUID: 52OpQkWopH_UijR_V1gH72otsGZlCUqw Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790714510612197936 X-GMAIL-MSGID: 1790714510612197936 Support the suspend operation. There is little to do, except flush to guarantee no workers are running when suspend returns. Signed-off-by: Steve Sistare --- drivers/vdpa/vdpa_user/vduse_dev.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c index 1d24da79c399..503030f19e52 100644 --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -472,6 +472,18 @@ static void vduse_dev_reset(struct vduse_dev *dev) up_write(&dev->rwsem); } +static void vduse_flush_work(struct vduse_dev *dev) +{ + flush_work(&dev->inject); + + for (int i = 0; i < dev->vq_num; i++) { + struct vduse_virtqueue *vq = dev->vqs[i]; + + flush_work(&vq->inject); + flush_work(&vq->kick); + } +} + static int vduse_vdpa_set_vq_address(struct vdpa_device *vdpa, u16 idx, u64 desc_area, u64 driver_area, u64 device_area) @@ -713,6 +725,17 @@ static int vduse_vdpa_reset(struct vdpa_device *vdpa) return ret; } +static int vduse_vdpa_suspend(struct vdpa_device *vdpa) +{ + struct vduse_dev *dev = vdpa_to_vduse(vdpa); + + down_write(&dev->rwsem); + vduse_flush_work(dev); + up_write(&dev->rwsem); + + return 0; +} + static u32 vduse_vdpa_get_generation(struct vdpa_device *vdpa) { struct vduse_dev *dev = vdpa_to_vduse(vdpa); @@ -794,6 +817,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = { .set_vq_affinity = vduse_vdpa_set_vq_affinity, .get_vq_affinity = vduse_vdpa_get_vq_affinity, .reset = vduse_vdpa_reset, + .suspend = vduse_vdpa_suspend, .set_map = vduse_vdpa_set_map, .free = vduse_vdpa_free, }; From patchwork Mon Feb 12 17:16:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Sistare X-Patchwork-Id: 199945 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp61146dyb; Mon, 12 Feb 2024 09:27:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU9dIhl9xd/XGdYNBJyPkAoJdLxSVSdUu3o4bVC1inSqW8igpPnj17fFgoI9831nW3NdkpXLlXkZWp8a2fUxwQMMT6Llw== X-Google-Smtp-Source: AGHT+IGzj260HMFJyeWRQ5O0cIo349PD3E0Awg4epcXLFvKM1x0Ppn7mhmIXRDk6nEGUqACXYz0Y X-Received: by 2002:a17:902:d48e:b0:1da:2b52:52d4 with SMTP id c14-20020a170902d48e00b001da2b5252d4mr4306381plg.39.1707758865308; Mon, 12 Feb 2024 09:27:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707758865; cv=pass; d=google.com; s=arc-20160816; b=mwdRMI14xZkwryfuoyVb2R8cHXQXdtRoCpdNiPCJdfASnsOCra3+WbAVrVsX0SwfrU AkE3WWv+/+EY2JwobyD0CcuYeOjNSwuGxLkJYEWn2ufSEmuudXpKU0pGFTsBnNE75YZl OmW1vpzf25K3tAP2mDT64gE7Gs903cxbNvPwHFj/dvEu3sKpSZ0DV9eQxqjJZCaJN8JJ /tyND9h8HNM8sTuHOMLrempEnMOCZL2X3evn79woKpDJe/Diy1rBbCa5U2tYCyWPZBg6 Z63JYlZgtkL1SAscXz56uNTihqVDUBiGF6wEMMylysCM4P070vBNlHP6O5Bz8b/5vh3A 4kIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=fhdNJEwldjv6IUUX+AIoeSMZpJt3+JWrlmxQbPSV190=; fh=XRcI9TXxaApnRyo2GGiWVe8lo1zK29YAFBq4jOHKv0c=; b=wJaWno44p4QRM9jLFOGJP4Qy31/mbOtWxvN0oWvoxFxmsitRY5TZRxhDS/5ZqklXwm FIIPwe1+M+M3aB0rGcQCRKBPvP6X3Qif947+fMP+zuStYLA+5qWxr+eDdFfugp0xCtyC Y6u2e9ota24uiDr18hRfDm5jkoUl9vFwayyPrmnAPZIsfnpC2t6atT8xWDFkzZu4y0i/ D3CRhPbLx9Llm5sgTCx5ethXS7IJgXe/Qh6zfQriM+8ni70NJCW7N1WoQUHHtPsRi9lX wzfoPKucdM2Zs7I7tL/TPR41wFKSsPLqH87j/Ef1TbRuAHK+LjtsT6bNGtc+jFOvFNXg iCew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=lrk7C3Xm; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-62080-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62080-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com X-Forwarded-Encrypted: i=2; AJvYcCXFhElel9qpMTwjh0B7aEmJPHm9wxeTDS4SSNtgaSSQCNabap5SG6ADCDAEnXavwdsPwXueFgoz0FYpTaISpFE5P/7HEw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p18-20020a170902e75200b001d8e7df68d9si536842plf.465.2024.02.12.09.27.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 09:27:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62080-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-11-20 header.b=lrk7C3Xm; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel+bounces-62080-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62080-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2AC0D28ACE4 for ; Mon, 12 Feb 2024 17:17:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A78083FE2E; Mon, 12 Feb 2024 17:16:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="lrk7C3Xm" Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FACB3F8C2 for ; Mon, 12 Feb 2024 17:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707758193; cv=none; b=nPCgSPWwY1HcJ1wBkOiEbUQ61pg8Jl9Sptq4ddm4F6v/9WVci7H3d9CFQ1/yYtg0j7tZRHTLWSx3jqGpBiGbKMzoTpJjgGm9SPc8y9wvlXXk/GavF/gbhp5piQSddW/f2//qZWG8j8vWvsY13p8wKK6vgkbGhQkRAGe7pIgxk/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707758193; c=relaxed/simple; bh=8YvGJ2ZZyQiC7K2q187z+72Db2SHCfeV/AIbRS4MrO8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ZY62IuKw0EVxmrL2VqnzVDAE+J+A6iOZh45GWi/JD8eWZVAZ6pykvJtNhCHDefrbgKKiH+Gkvq6oWe2JDzSgxHWt54L5jCEGB8gjS72babX2u8jali25bWULyX8rrCZkLoKS38sZEcbUJ86QpDVcZB+8TL4oOpZjJJK1XEddE2U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b=lrk7C3Xm; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41CH8lKn017068; Mon, 12 Feb 2024 17:16:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2023-11-20; bh=fhdNJEwldjv6IUUX+AIoeSMZpJt3+JWrlmxQbPSV190=; b=lrk7C3XmHpr9hqdFhIHIUkxs3jui7oXu7hf/Y9opTu9qbbHvVKIrGMVpwBodB+cD+S1u EvyIsa6q+RhAgu01Omd9xmE9pmh+DJzSnP+TZBqEAtDwGUFvho9FpRCgHD0ZAVALaFWR YrrBnZJJLAr7l3AHnCmFZosfelAS5IOkAKkZAJxtJ2qKX+GDA9lh3vK6wBBmDpNgOhTS DA+VPhumPPGHkXzmPby1zUpPSqLaw0nLQOs6d/PKR4DS6AXOcJF72FLUDiSg+0zMLE8d 2Iv6VmKs3AYIUfgJn/2dyv9Z9tLw+0VymDWz2Bmv9i+0V7OFJISVEG2KiBmGg7civ+ZP KA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3w7mpqggaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:16:20 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41CGHEXh031321; Mon, 12 Feb 2024 17:16:20 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3w5yk620g5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 12 Feb 2024 17:16:20 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 41CHGFCE019216; Mon, 12 Feb 2024 17:16:19 GMT Received: from ca-dev63.us.oracle.com (ca-dev63.us.oracle.com [10.211.8.221]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3w5yk620cq-4; Mon, 12 Feb 2024 17:16:19 +0000 From: Steve Sistare To: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Jason Wang , Si-Wei Liu , Eugenio Perez Martin , Xie Yongji , Stefano Garzarella , Steve Sistare Subject: [PATCH V2 3/3] vdpa_sim: flush workers on suspend Date: Mon, 12 Feb 2024 09:16:14 -0800 Message-Id: <1707758174-142161-4-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1707758174-142161-1-git-send-email-steven.sistare@oracle.com> References: <1707758174-142161-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-12_14,2024-02-12_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402120131 X-Proofpoint-GUID: djMs8rQaCzFpOPn0bvE4a5muSqxH_YcW X-Proofpoint-ORIG-GUID: djMs8rQaCzFpOPn0bvE4a5muSqxH_YcW Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790714959691796537 X-GMAIL-MSGID: 1790714959691796537 Flush to guarantee no workers are running when suspend returns. Signed-off-by: Steve Sistare --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index be2925d0d283..a662b90357c3 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -74,6 +74,17 @@ static void vdpasim_worker_change_mm_sync(struct vdpasim *vdpasim, kthread_flush_work(work); } +static void flush_work_fn(struct kthread_work *work) {} + +static void vdpasim_flush_work(struct vdpasim *vdpasim) +{ + struct kthread_work work; + + kthread_init_work(&work, flush_work_fn); + kthread_queue_work(vdpasim->worker, &work); + kthread_flush_work(&work); +} + static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) { return container_of(vdpa, struct vdpasim, vdpa); @@ -511,6 +522,8 @@ static int vdpasim_suspend(struct vdpa_device *vdpa) vdpasim->running = false; mutex_unlock(&vdpasim->mutex); + vdpasim_flush_work(vdpasim); + return 0; }