From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FB1FC10F06 for ; Sat, 6 Apr 2019 05:59:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E099821855 for ; Sat, 6 Apr 2019 05:59:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="LYdJQ2PD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbfDFF7s (ORCPT ); Sat, 6 Apr 2019 01:59:48 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53487 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbfDFF7s (ORCPT ); Sat, 6 Apr 2019 01:59:48 -0400 Received: by mail-wm1-f66.google.com with SMTP id q16so8714637wmj.3 for ; Fri, 05 Apr 2019 22:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5PMKv2ugJiYGlVcgbznH9eYnc0jyJ86FvU3qaleaRDU=; b=LYdJQ2PDv976+LwCwx8Ovlg/GmJowYv7ACG+MkHesA2Pq21rarRIFNnJnQQFAxWmTz Oc1aJQ3lEYgFqmURiIFhIMdhYFB8wRutfTC15NZMfFUEG0e1FqnMod/8VMrfPITb7wGS ocn/5SQTDCNstU+62+OR3Mo3mba/GEJ/TldISUwdbcYCljRxeF6YAo+lMPD/LUqb1hGT 4+6+DZcp8FTTGwR3iUpbOTTgVP4ndg4PRgIM8bWunTUUBrvg99bkPw72MQG45iZt2zIR wZpBiBZz4m62DYLNEopqh7ZtWLP7OOJe3nz4o1N5GwIgBO1n1FFC1Ra7Iw6hALWlH4v9 s50A== 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=5PMKv2ugJiYGlVcgbznH9eYnc0jyJ86FvU3qaleaRDU=; b=IKNJyYEg6V04EP8l/kDMAHQdTGlO6P0sv2kHTzQn+lmba0a32Lxh7ntPulqpqjmk1+ W3Mf83Xp50J78wWspHolO9M/qPjg+tQ4CzBw7vTcWS9RbWl/gCqSdKS/BqnrSlm1WIJc vRKjuhgZUmGE+A4bV+td0aS04IaSVjXfj2fcUDRa8rHzJPqQQSimSMHX1ZcPCHx0P1Ev iEizX5iNiTJVqKaoEzN3U0zlxIJ2Cy8l+to9WsR5xEoONJ8Dd9fDVAyiYA3GPHVaYPjI 9r/03C8wRZKHFh+hamiN1rjuuJoLP7FtnBi0T++blTWSfc5fJF7k+VCsOIHR4yJ2rX8t NQxQ== X-Gm-Message-State: APjAAAWCUDDuGHbLbj0s2U5mC0xdOJr9OCayuQvtiKaZw61n0yNUosHi i5y0OpFl+9ic4vxPj60ZOv30fg== X-Google-Smtp-Source: APXvYqyuHOwu2z1JEQCbHXuWo+96dSttdoaOkjlSGPg9mlDtgbyIlCmOoF0Df3mtC/suovEQjzK09A== X-Received: by 2002:a7b:ce1a:: with SMTP id m26mr10408853wmc.131.1554530386709; Fri, 05 Apr 2019 22:59:46 -0700 (PDT) Received: from localhost (jirka.pirko.cz. [84.16.102.26]) by smtp.gmail.com with ESMTPSA id x14sm5464171wmj.3.2019.04.05.22.59.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Apr 2019 22:59:46 -0700 (PDT) Date: Sat, 6 Apr 2019 07:59:45 +0200 From: Jiri Pirko To: Vlad Buslov Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, davem@davemloft.net, john.hurley@netronome.com Subject: Re: [PATCH net-next] net: sched: flower: insert filter to ht before offloading it to hw Message-ID: <20190406055945.GA3236@nanopsycho.orion> References: <20190405175626.4123-1-vladbu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190405175626.4123-1-vladbu@mellanox.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fri, Apr 05, 2019 at 07:56:26PM CEST, vladbu@mellanox.com wrote: >John reports: > >Recent refactoring of fl_change aims to use the classifier spinlock to >avoid the need for rtnl lock. In doing so, the fl_hw_replace_filer() >function was moved to before the lock is taken. This can create problems >for drivers if duplicate filters are created (commmon in ovs tc offload >due to filters being triggered by user-space matches). > >Drivers registered for such filters will now receive multiple copies of >the same rule, each with a different cookie value. This means that the >drivers would need to do a full match field lookup to determine >duplicates, repeating work that will happen in flower __fl_lookup(). >Currently, drivers do not expect to receive duplicate filters. > >To fix this, verify that filter with same key is not present in flower >classifier hash table and insert the new filter to the flower hash table >before offloading it to hardware. Implement helper function >fl_ht_insert_unique() to atomically verify/insert a filter. > >This change makes filter visible to fast path at the beginning of >fl_change() function, which means it can no longer be freed directly in >case of error. Refactor fl_change() error handling code to deallocate the >filter with rcu timeout. > >Fixes: 620da4860827 ("net: sched: flower: refactor fl_change") >Reported-by: John Hurley >Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko