Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4466391imm; Mon, 30 Jul 2018 15:28:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfux+Al+RXnuSCXa5vIC2079oZNh5RpzHAbXNjfteai2P1CYwe95ZmzK3WCVULJ4Ape3Qgi X-Received: by 2002:a63:4e25:: with SMTP id c37-v6mr8951271pgb.6.1532989689308; Mon, 30 Jul 2018 15:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532989689; cv=none; d=google.com; s=arc-20160816; b=xfW90XqR/msi8JiFdn4tmtD2MRvjydT+HjA2CQ1r70PqQHp0XQWsSojflBnAyM0GSc yZakfqXrR/2HmqPriHUN8P61pw2CFq5e8APpwpDmf/AdjFHG4DUDUgRrxIizy/5D/NR+ OThmI9iFua/VRBOgmqtHFL1r7meYZ1xxAYKO3D2CZOeSRm60wz6DgTDKWF3nNqb09cbV wM1rJvLwoAgJ3I43VQKNa8lBWtv35g5hmserXk8+EyO9sqluJssyYscu+djfhcLEOsty 8Z4HXHBgXLmQ0NPDPWbiKH8IOKHRTn/o5qfH1d5ehoAH23r8RzcbROI8kfDHS+SfPHuC Gg1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=OxMSe7YAOB0t1WLkNWLZWO7EX9YmyhlpLisj6e0VyCs=; b=Gy6MT1pfZ8vXwDRYkbiimqpa9yioFSU0KygXylFXgMlRPkL1T1cG5kd0/gBSYkJhWO N4TeNim3eTaltKNDUMpEGaZdu8TQY/iCGX/RxYxY3VJ7HEKPHe7lQvXbhC9IytXNXw/E 2JpiT7QXzQsTGwR2ak4/SOiEMhMenyDaawsOyyRWgfHu+Lh31uweLdCi9uHymQjpyI8E GHwfWAW560dkvpxhp+mTwyRs6eWeQ03kacp6ZdhY67CoBBCvYuAnsd12TcmVZi/9jlHT TtIEdO3hvHj+NqI+sL+UKBiw3A3RQQoOFVdKynC09OKHUk7MXggyxHnulw2VulfW1l/a 4HTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=PmuS9fI4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1-v6si1237285plb.348.2018.07.30.15.27.55; Mon, 30 Jul 2018 15:28:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=PmuS9fI4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731760AbeGaAEF (ORCPT + 99 others); Mon, 30 Jul 2018 20:04:05 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39829 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726966AbeGaAEE (ORCPT ); Mon, 30 Jul 2018 20:04:04 -0400 Received: by mail-pg1-f193.google.com with SMTP id a11-v6so7993700pgw.6 for ; Mon, 30 Jul 2018 15:26:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OxMSe7YAOB0t1WLkNWLZWO7EX9YmyhlpLisj6e0VyCs=; b=PmuS9fI4BY4b8eHvLyzT6InmtWBeN7+o0DyW1oYcN6ZL9JFKzZlLfrTZU5FA2oH0n5 ucM5b+xIDqQJFwJoTLYUvJH1LmgRfKogd4cMC/ahAdO0bTTeAtPT0gEK9IlKtoz1/OBU bk2dXGJf79zsd3k4DV8YRV4W/5fh12RztMYFM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OxMSe7YAOB0t1WLkNWLZWO7EX9YmyhlpLisj6e0VyCs=; b=b8uJv+RG5DymLDpbD4HVwrECa0XvZIyRxZ/AeA8pj8pYTHiFW96UZlGS4GUFmIHf4C 3GRZNSkpMfNLhsEp4RxZpO/T/zxtT34ia7vOD+qvVCX2F17wg1rg9JxxlkpXKTrl1j41 lmBCchNXS6dwXxqANRsyB5vHRhdN6HYsiWi4MqEs5yBY9dbTlWWHsIyAJ+Qyjr7J05PL xcc4aYo3iKm0zCcNqIvYde6NcvHSdGvZtVIM2tpHzXZRgZDFXHZBEA6XYHVFmw99/qwn H7Af4Oj+WN7xQHEqVh39jswPTm9X/kngDi5IfhsGMcOWT1L6Scen4W4KzmHzY8jVDj++ 9bKQ== X-Gm-Message-State: AOUpUlFLh31945BL/gIZbVn9vUg2GN7AaAZY+NTl0d1E7MlWWu7b4R2g YTQmahy+/7uhgWswN+6xlOm7pw== X-Received: by 2002:a63:195e:: with SMTP id 30-v6mr17792153pgz.192.1532989618668; Mon, 30 Jul 2018 15:26:58 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id x66-v6sm29710348pff.123.2018.07.30.15.26.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 15:26:58 -0700 (PDT) Date: Mon, 30 Jul 2018 15:26:57 -0700 From: Joel Fernandes To: Alexei Starovoitov Cc: Daniel Colascione , Lorenzo Colitti , Chenbo Feng , Mathieu Desnoyers , Joel Fernandes , Alexei Starovoitov , lkml , Tim Murray , Daniel Borkmann , netdev Subject: Re: [RFC] Add BPF_SYNCHRONIZE bpf(2) command Message-ID: <20180730222657.GA197142@joelaf.mtv.corp.google.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 29, 2018 at 06:57:06PM +0300, Alexei Starovoitov wrote: > On Fri, Jul 27, 2018 at 10:17 PM, Daniel Colascione wrote: > > On Sat, Jul 14, 2018 at 11:18 AM, Joel Fernandes > > wrote: > >> > >> By the way just curious I was briefly going through kernel/bpf/arraymap.c. > >> How are you protecting against load-store tearing of values of array map > >> updates/lookups? > >> > >> For example, if userspace reads an array map at a particular index, while > >> another CPU is updating it, then userspace can read partial values / > >> half-updated values right? Since rcu_read_lock is in use, I was hoping to > >> find something like rcu_assign_pointer there to protect readers against > >> concurrent updates. Thanks for any clarification. > > > > > > I'm also curious about the answer to this question. > > i'm not sure I understand the question. > bpf_map_type_array is a C-like array. > There is no locking of elements. > If single program executing on two cpus > and accesses the same value it will collide. > Same goes for user space vs prog parallel access. > bpf long_memcpy is an attempt to provide minimal > level of automicity when values are aligned and > size==long. Thanks for the answer. I think you answered the question. Regards, - Joel