From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 0EE4E58DC for ; Wed, 23 Jul 2014 00:11:38 +0200 (CEST) Received: by mail-wg0-f47.google.com with SMTP id b13so287666wgh.6 for ; Tue, 22 Jul 2014 15:12:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=97JzQksSNub+TPZORIao3H1zR45RfPnrIbOQHkl1XIc=; b=QGrNCaA5elzyHxe8m0K4Dn1a3m6QVPS1sMqjuvYiQar9EhkIfavrqCdT8fxew7Ya4Q yCiZ8vpm31j/PmW+r5YDOUzt5vsepaU91QENCXA2oaPgIeph8O7dd55gRIZtp7vCBA2x j0EqRbc6kM5qwzoXoSU0VbdSB78ZO9HlAcVGpJcWReSqmJgx1G3av6exjg9dgDJon1TB HP4mHoM82A2oMtfRdRVv3YaxMWdWtpQsSUECwtZLuhekFKp+Y9jL+vNetj6MNlMLyDwe iDqGGZnb/eF9F5dPPrbkoDYmqJ5GkF2fel58CDw57clWwbYTox9T47tvx6CFvKpYHe4N hwEw== X-Gm-Message-State: ALoCoQngwXjsGqqMR8Gg50tUZPBcaKNLY2kXxktj5lO6CQy/PMxI02pI8qq6rRYmoHyE6aNg1287 X-Received: by 10.180.89.143 with SMTP id bo15mr18525309wib.78.1406067178692; Tue, 22 Jul 2014 15:12:58 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id bg2sm1391227wib.21.2014.07.22.15.12.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jul 2014 15:12:57 -0700 (PDT) From: Thomas Monjalon To: Anatoly Burakov Date: Wed, 23 Jul 2014 00:12:50 +0200 Message-ID: <2404082.72VjJeX9XE@xps13> Organization: 6WIND User-Agent: KMail/4.13.2 (Linux/3.15.5-2-ARCH; KDE/4.13.2; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 00/10] Make DPDK tailqs fully local X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jul 2014 22:11:38 -0000 2014-06-20 16:42, Anatoly Burakov: > This issue was reported by OVS-DPDK project, and the fix should go to > upstream DPDK. This is not memnic-related - this is to do with > DPDK's rte_ivshmem library. > > Every DPDK data structure has a corresponding TAILQ reserved for it in > the runtime config file. Those TAILQs are fully local to the process, > however most data structures contain pointers to next entry in the > TAILQ. > > Since the data structures such as rings are shared in their entirety, > those TAILQ pointers are shared as well. Meaning that, after a > successful rte_ring creation, the tailq_next pointer of the last > ring in the TAILQ will be updated with a pointer to a ring which may > not be present in the address space of another process (i.e. a ring > that may be host-local or guest-local, and not shared over IVSHMEM). > Any successive ring create/lookup on the other side of IVSHMEM will > result in trying to dereference an invalid pointer. > > This patchset fixes this problem by creating a default tailq entry > that may be used by any data structure that chooses to use TAILQs. > This default TAILQ entry will consist of a tailq_next/tailq_prev > pointers, and an opaque pointer to arbitrary data. All TAILQ > pointers from data structures themselves will be removed and > replaced by those generic TAILQ entries, thus fixing the problem > of potentially exposing local address space to shared structures. > > Technically, only rte_ring structure require modification, because > IVSHMEM is only using memzones (which aren't in TAILQs) and rings, > but for consistency's sake other TAILQ-based data structures were > adapted as well. > > As part of this patchset, rte_malloc is also fixed to properly support > multiprocess malloc and free. Previously, if the memory was malloc'd > and freed in different processes, this could lead to segmentation > faults due to different heap pointers in malloc elements themselves. > This is fixed by making shared config to be mapped at the same > addresses in both primary and secondary processes, so that the heap > pointers in malloc elements are always valid, whatever process is > doing malloc or free. > > The mapping address for the shared config is also now set with the > base-virtaddr flag, mapping the config file just before the start > address for the hugepages. > > v2 changes: > * fixed race conditions in *_free operations > * fixed multiprocess support for malloc heaps > * added similar changes for acl > * rebased on top of e88b42f818bc1a6d4ce6cb70371b66e37fa34f7d > > v3 changes: > * fixed race reported by Konstantin Ananyev (introduced in v2) > > v4 changes: > * rte_mem_config mapping address is now also set by --base-virtaddr > > Anatoly Burakov (10): > eal: map shared config into exact same address as primary process > eal: use --base-virtaddr for mapping rte_config as well > rte_tailq: change rte_dummy to rte_tailq_entry, add data pointer > rte_ring: make ring tailq fully local > rte_hash: make rte_hash tailq fully local > rte_fbk_hash: make rte_fbk_hash tailq fully local > rte_mempool: make mempool tailq fully local > rte_lpm: make lpm tailq fully local > rte_lpm6: make lpm6 tailq fully local > rte_acl: make acl tailq fully local Applied for version 1.7.1. Thanks -- Thomas