From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk0-f48.google.com (mail-vk0-f48.google.com [209.85.213.48]) by dpdk.org (Postfix) with ESMTP id D95559AC4 for ; Wed, 2 Mar 2016 15:01:33 +0100 (CET) Received: by mail-vk0-f48.google.com with SMTP id k196so203129464vka.0 for ; Wed, 02 Mar 2016 06:01:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=i2EG5tYeLq2hg0Gzznv6ylYox8YWIWM3Ly3BOWFxWVc=; b=TjvlvhOLSFsMDPw2v1aysJjhZJ/E192l6vWj9xte2bSy8OizlztYTPzyCpMLS6A3uf AD1/g0USsLm03uRE2fy9RXYPEFSr3oliEKkD6qojOJgv8wTjsyft8oaRzjVH9jVhlJSo u3DgKMgL9BBNg4hLpDQQPr2HbrCi/Aqyw2HMZCOVAnLutyTk3XXMUS4Pc2CoSJtDhkLY qJvHo270yKQr+RIt7KVFjlZwd2eeEAFg+nJe0q10qnfzVrdOVWOu2WEQtpL0AOq7zACR Jh+aXX7/tJ6WaKlrO6k60OTb+qVcGX9p3fvuIaxB0RpTLplWpN4wZpKfj/rXAfeeNaOF OUdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=i2EG5tYeLq2hg0Gzznv6ylYox8YWIWM3Ly3BOWFxWVc=; b=G3xAbfoN2Ij8S7VN+4VDXvJAT6XtImcuEB1o/gIhkFMMnTpOvvS+QZ/ANBNs2BC9S7 rw8CfbIV2UuAZkm5swrAY1XT4fbfZy8SUi2zYV7GDrCfY4dm0zUbn1fTRw7mxuLrU3lw wqZGJuXNzhgKDKDsEGg/LQzwbwJcfiOxtsR20ZGkn63ET6WneiBTg6shzswjWxOhI0Yt IZDo40O027KWckQPfIYoNBJ+dUrqVyDaCF61+d3KaPVcLUeBQ4bpXiE0cQNa51T8t+j0 OfzRmwpKKIwVvmTaYJK028XYfjFfOchNVKHtp+sxYYlZztK6huI34FaHDNz+IH6zurgf k9vw== X-Gm-Message-State: AD7BkJKNtRRpQLIW6cM+xYhZbwSZ79PwE0FyBAJtfZIan+spEM0ZMny/TzIQ+mbEiOA+PE6k0Op35Wnw2b8XFQ== MIME-Version: 1.0 X-Received: by 10.31.56.13 with SMTP id f13mr17440543vka.20.1456927293315; Wed, 02 Mar 2016 06:01:33 -0800 (PST) Received: by 10.31.237.129 with HTTP; Wed, 2 Mar 2016 06:01:33 -0800 (PST) In-Reply-To: <533710CFB86FA344BFBF2D6802E6028622F5ACB9@SHSMSX101.ccr.corp.intel.com> References: <533710CFB86FA344BFBF2D6802E6028622F5ACB9@SHSMSX101.ccr.corp.intel.com> Date: Wed, 2 Mar 2016 09:01:33 -0500 Message-ID: From: Dhananjaya Reddy Eadala To: "Qiu, Michael" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] hash: fix memcmp function pointer in multi-process 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: Wed, 02 Mar 2016 14:01:34 -0000 Michael Please find the attached is the patch file generated from "git format-patch -1" Thanks Dhana On Tue, Mar 1, 2016 at 9:29 PM, Qiu, Michael wrote: > On 3/2/2016 2:57 AM, Dhananjaya Reddy Eadala wrote: > > Hi > > > > We found a problem in dpdk-2.2 using under multi-process environment. > > Here is the brief description how we are using the dpdk: > > > > We have two processes proc1, proc2 using dpdk. These proc1 and proc2 are > > two different compiled binaries. > > proc1 is started as primary process and proc2 as secondary process. > > > > proc1: > > Calls srcHash = rte_hash_create("src_hash_name") to create rte_hash > > structure. > > As part of this, this api initalized the rte_hash structure and set the > > srcHash->rte_hash_cmp_eq to the address of memcmp() from proc1 address > > space. > > > > proc2: > > calls srcHash = rte_hash_find_existing("src_hash_name"). This returns > the > > rte_hash created by proc1. > > This srcHash->rte_hash_cmp_eq still points to the address of memcmp() > from > > proc1 address space. > > Later proc2 calls rte_hash_lookup_with_hash(srcHash, (const void*) &key, > > key.sig); > > Under the hood, rte_hash_lookup_with_hash() invokes > > __rte_hash_lookup_with_hash(), which in turn calls > h->rte_hash_cmp_eq(key, > > k->key, h->key_len). > > This leads to a crash as h->rte_hash_cmp_eq is an address from proc1 > > address space and is invalid address in proc2 address space. > > > > We found, from dpdk documentation, that > > " > > The use of function pointers between multiple processes running based of > > different compiled > > binaries is not supported, since the location of a given function in one > > process may be different to > > its location in a second. This prevents the librte_hash library from > > behaving properly as in a multi- > > threaded instance, since it uses a pointer to the hash function > internally. > > > > > > To work around this issue, it is recommended that multi-process > > applications perform the hash > > calculations by directly calling the hashing function from the code and > > then using the > > rte_hash_add_with_hash()/rte_hash_lookup_with_hash() functions instead > of > > the functions which do > > the hashing internally, such as rte_hash_add()/rte_hash_lookup(). > > " > > > > We did follow the recommended steps by invoking > rte_hash_lookup_with_hash(). > > It was no issue up to and including dpdk-2.0. In later releases started > > crashing because rte_hash_cmp_eq is introduced in dpdk-2.1 > > > > We fixed it with the following patch and would like to submit the patch > to > > dpdk.org. > > Could you send the patch in the mail? > > Learn how to send a patch: > > http://www.dpdk.org/dev > > Thanks, > Michael > > Patch is created such that, if anyone wanted to use dpdk in multi-process > > environment with function pointers not shared, they need to > > define RTE_LIB_MP_NO_FUNC_PTR in their Makefile. Without defining this > flag > > in Makefile, it works as it is now. > > > > > > Please find here attached is the patch file. > > > > Thanks > > Dhana > > > >