Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7221191ybi; Mon, 8 Jul 2019 17:14:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW38reZ8cCdqAxCYMIdNY1LIHPJpG7F2J4MBpHBjXbmu7Oq4CD6kePCvKqScu6WKKDzCkW X-Received: by 2002:a63:2b8e:: with SMTP id r136mr26737501pgr.216.1562631260192; Mon, 08 Jul 2019 17:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562631260; cv=none; d=google.com; s=arc-20160816; b=wM31cxZfcaSipvyMUTOHbudGFs9qrtcDg/TUBz4XfqBNP0HwkANiP9peTXH/21PpIL IG0u7YFIiYN0nz5sKXha64TiJe2DTVmqTts198h8RdFJssz0vXCY/XGpf4icfDnJ4H4P Xnb94YiwRwBUxIdxkWuhuQMCiSOqIHATe6WFmGBKfPD1MOxspUCJFY1JyQO3NgyvGqw9 a2OJZ4WHeaXdECZSuFjrDCyy5u1dhckI7OT/SKQ7DAVk/lQuvyL3t3+6zqk0AcC5vdXU bcug/O31h8WqxDqa6vXEY4cOX1HLyvPV9CFIc1k0dRhWgEqve7+PrKOvpcq68bBno54F CZyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=gPNh8LmowzrJaUGtXwVmKIMvf462JT3kVZq3LLUIzEY=; b=rUY2aZCv+cBFUVh6CCN47kKV3PIiZZ1cdJCIBxV44NBI1mN1BS7O9LWychyiRQnNSv coKIYsG6uvMAgvgmj23TjXsv3rFUbumMlDFgqmmr1LyjpC4MOe+F9vq7WRoDTThICAyS R5vg1VD62d2TKaaoHk8t3/4s2gZr60aNYDXIALiWxX+a2Nm//wukjq1V/h9BqKHaDNLe 0+8+v0pU1ArP5V9Kw6yCkWLUmafJOF41ofUbNTTfQgFnH/gSYiq1pWmrAxf29uavs+m3 YTrfL0KMoZxNQVbI6+AZ7IZ/x0lYy98q+ml93kcHGv45pYdGpHQk47JP3JtkIcnde2Eg iygA== ARC-Authentication-Results: i=1; mx.google.com; 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 l1si20485711pgm.391.2019.07.08.17.14.05; Mon, 08 Jul 2019 17:14:20 -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; 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 S1726601AbfGIANb (ORCPT + 99 others); Mon, 8 Jul 2019 20:13:31 -0400 Received: from www62.your-server.de ([213.133.104.62]:50184 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbfGIANb (ORCPT ); Mon, 8 Jul 2019 20:13:31 -0400 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1hkdl5-0007Yh-3I; Tue, 09 Jul 2019 02:13:23 +0200 Received: from [178.193.45.231] (helo=linux.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1hkdl4-00029D-QR; Tue, 09 Jul 2019 02:13:22 +0200 Subject: Re: [PATCH bpf v2] xdp: fix race on generic receive path To: Ilya Maximets , netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, xdp-newbies@vger.kernel.org, "David S. Miller" , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , Jakub Kicinski , Alexei Starovoitov References: <20190703120916.19973-1-i.maximets@samsung.com> From: Daniel Borkmann Message-ID: <1ac9c018-09c0-1123-ed97-b230a2117533@iogearbox.net> Date: Tue, 9 Jul 2019 02:13:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20190703120916.19973-1-i.maximets@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.3/25504/Mon Jul 8 10:05:57 2019) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/2019 02:09 PM, Ilya Maximets wrote: > Unlike driver mode, generic xdp receive could be triggered > by different threads on different CPU cores at the same time > leading to the fill and rx queue breakage. For example, this > could happen while sending packets from two processes to the > first interface of veth pair while the second part of it is > open with AF_XDP socket. > > Need to take a lock for each generic receive to avoid race. > > Fixes: c497176cb2e4 ("xsk: add Rx receive functions and poll support") > Signed-off-by: Ilya Maximets Applied, thanks!