From patchwork Mon Apr 15 10:21:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1085571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="p7CC1E1A"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44jPfh5P6dz9s47 for ; Mon, 15 Apr 2019 20:21:15 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 37FD8EB5; Mon, 15 Apr 2019 10:21:12 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 16BB6EA6 for ; Mon, 15 Apr 2019 10:21:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 64C812C3 for ; Mon, 15 Apr 2019 10:21:10 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190415102108euoutp02d9283689de72799b567867d2b8a3d559~VnqLNI0091319313193euoutp02c for ; Mon, 15 Apr 2019 10:21:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190415102108euoutp02d9283689de72799b567867d2b8a3d559~VnqLNI0091319313193euoutp02c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1555323668; bh=2VMibcJni7IH4COlQ2O/cvk4mhhP58nRq47kRblwh58=; h=From:To:Cc:Subject:Date:References:From; b=p7CC1E1AlgGZrZikex7E7MOL/GkGmTids+px5uNv4Hsl3qM01LgJJpI5NgrgUnEry MbFaiCzY5PVifLyHF8Sg3KnKdZvDBG7P6DkpR3LvlqGGEKOMbh03SyUFlJcLBM19C0 m7Ar5DrznP+JG2w2ABiVe94BNAzDVLaPn+mGYjmI= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190415102107eucas1p1c19d4dbe562eb214abe11e878506e43a~VnqKh1Wtk2722627226eucas1p1U; Mon, 15 Apr 2019 10:21:07 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 51.F0.04377.31B54BC5; Mon, 15 Apr 2019 11:21:07 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190415102106eucas1p217bc6a0d138d042a8d753776860d3e7e~VnqJpEOeH3064330643eucas1p2L; Mon, 15 Apr 2019 10:21:06 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190415102106eusmtrp2f58e67a2074bdc18720bbefe2dbd4cc3~VnqJZjcev1288212882eusmtrp2R; Mon, 15 Apr 2019 10:21:06 +0000 (GMT) X-AuditID: cbfec7f4-12dff70000001119-2d-5cb45b13eddf Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 11.BA.04140.21B54BC5; Mon, 15 Apr 2019 11:21:06 +0100 (BST) Received: from localhost.localdomain (unknown [106.109.129.180]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190415102106eusmtip26f42152ad26c34f6f129c5978408f513~VnqJBRUEy2950629506eusmtip2O; Mon, 15 Apr 2019 10:21:05 +0000 (GMT) From: Ilya Maximets To: ovs-dev@openvswitch.org, Ben Pfaff Date: Mon, 15 Apr 2019 13:21:00 +0300 Message-Id: <20190415102100.26664-1-i.maximets@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGIsWRmVeSWpSXmKPExsWy7djP87rC0VtiDI5eE7V4NbmB0WL3jRKL K+0/2S3mfnrO6MDi0XLkLavHs5v/GT2eX+th8ejbsooxgCWKyyYlNSezLLVI3y6BK2P649nM BRs5Kpa1/mJvYLzH1sXIySEhYCJxZskTMFtIYAWjxO63BV2MXED2F0aJM28Ws0E4nxklOt/9 ZIbpODDhHStEx3JGiflLVSGKvjJKXF79BCzBJqAjcWr1EUYQWwSoYdnUb0CTODiYBfwlmqfV gpjCAg4S9z/Wg1SwCKhK7Lp1lh3E5hWwljj8ZBXUcfISqzccYAYZLyGwhU1i+uEGRoiEi8St uX0sELawxKvjW9ghbBmJ/zvnM0HY9RL3W14yQjR3MEpMP/QPKmEvseX1OXaIezQl1u/SBzEl BBwlDjypgjD5JG68FQQpZgYyJ22bzgwR5pXoaBOCmKEi8fvgcmiASEncfPcZ6gAPifm3NkGD M1ai5+YptgmMcrMQVi1gZFzFKJ5aWpybnlpslJdarlecmFtcmpeul5yfu4kRGNun/x3/soNx 15+kQ4wCHIxKPLwXKjfHCLEmlhVX5h5ilOBgVhLhFegACvGmJFZWpRblxxeV5qQWH2KU5mBR EuetZngQLSSQnliSmp2aWpBaBJNl4uCUamBc+Xqfi7zIZMWziWsdZpg/2fxhgeSkZYHJDz2e Rv66FbxUSW/CjW83j5/smDkr5xr3wfpX15pq/Y9F+C5dsip/eeLS51uLfxks4NH/t+NA61yO m77OVacOJvupaR07ait0fE8H85SnObeKvvM7fOvOXFezaq7c6gNWfMd6T7OnS7RKm/vemXOn W4mlOCPRUIu5qDgRAGFpUdzpAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVy+t/xe7pC0VtiDBY/krR4NbmB0WL3jRKL K+0/2S3mfnrO6MDi0XLkLavHs5v/GT2eX+th8ejbsooxgCVKz6Yov7QkVSEjv7jEVina0MJI z9DSQs/IxFLP0Ng81srIVEnfziYlNSezLLVI3y5BL2P649nMBRs5Kpa1/mJvYLzH1sXIySEh YCJxYMI71i5GLg4hgaWMErs+X2WBSEhJ/Ph1gRXCFpb4c60LrEFI4DOjxLrDuiA2m4COxKnV Rxi7GDk4RATMJLb8swQJMwv4S9z8dQ4sLCzgIHH/Yz1ImEVAVWLXrbPsIDavgLXE4SeroE6Q l1i94QDzBEaeBYwMqxhFUkuLc9Nzi430ihNzi0vz0vWS83M3MQLDatuxn1t2MHa9Cz7EKMDB qMTDe6Fyc4wQa2JZcWXuIUYJDmYlEV6BDqAQb0piZVVqUX58UWlOavEhRlOg5ROZpUST84Eh n1cSb2hqaG5haWhubG5sZqEkznveoDJKSCA9sSQ1OzW1ILUIpo+Jg1OqgVH5UdjTqv+vvvOu d/dvuntb7Xve75ehtyfYK3Dqqf+M1lR+8utnaYPswhrvtLBFauVqCdfa99jOr2m6OK3dkc+E 21IqziDBZLHLdbcw/+zIyKvSb6RNW0y0olsEV2wrWTZtkVYzV3a6W6937oJpz+vPa8Ucc746 TXiZr1STVYVP7tMHTHtvKbEUZyQaajEXFScCACstMYZBAgAA X-CMS-MailID: 20190415102106eucas1p217bc6a0d138d042a8d753776860d3e7e X-Msg-Generator: CA X-RootMTR: 20190415102106eucas1p217bc6a0d138d042a8d753776860d3e7e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190415102106eucas1p217bc6a0d138d042a8d753776860d3e7e References: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets , Zhantao Fu Subject: [ovs-dev] [PATCH] pvector: Document the entry destruction policy. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This describes how to safely destroy pvector entries after removal. Signed-off-by: Ilya Maximets --- Wording/spelling suggestions are welcome. lib/pvector.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/pvector.h b/lib/pvector.h index b175b213d..b990ed9d5 100644 --- a/lib/pvector.h +++ b/lib/pvector.h @@ -54,6 +54,13 @@ * 'temp' may contain NULL pointers and it may be in unsorted order. It is * sorted before it is published at 'impl', which also removes the NULLs from * the published vector. + * + * Since the vector is RCU protected, the entry destruction after removal must + * be RCU postponed. Also, if it happens before changes published with + * pvector_publish(), destruction must be double postponed, i.e., the second + * ovsrcu_postpone() call to destruct the entry should be called from the first + * RCU callback. This is required because readers could still obtain the + * unmodified vector until updated version is published. */ struct pvector_entry {