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=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED,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 E8235C10F03 for ; Thu, 25 Apr 2019 08:26:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A85F9214AE for ; Thu, 25 Apr 2019 08:26:47 +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="JkYEewtM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729321AbfDYI0q (ORCPT ); Thu, 25 Apr 2019 04:26:46 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33459 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726451AbfDYI0q (ORCPT ); Thu, 25 Apr 2019 04:26:46 -0400 Received: by mail-wm1-f67.google.com with SMTP id z6so1158572wmi.0 for ; Thu, 25 Apr 2019 01:26:45 -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=x3XuxkqqJoyfLBumqzssFMHKXQKDcpLn6n4+GXtxSp4=; b=JkYEewtM/7aOJBZV6xJC0RNv2bPPA8SSNt7D2pgUYAnASEDrMDtsJ0GU8HOrhKexso cYebJHeL5fCYkBe9W+FB2XqGxbxMBiNlJ9dyNq9OCTa3w3hE3GpPMY4MpDdIsjfIQhDc IFisE/ZfilwAKN1gRCSmwGx5HA/FPRAo6KxeNvJUKkgI+Hypcr5UWjsjKD0ZEkfjKdhM AJeztilQYU1/rSHfYvckn0ORCpr2DkF+dkrBpeq6rupX/WXW27hl6mZIbCkrZVmWiWQF uZ6cbrSYnrTzT4bDJ3cChFrp0/bljBmwE0c82RPsYmOtb31lkRA8op82TqjT9bdNWd0l 43QA== 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=x3XuxkqqJoyfLBumqzssFMHKXQKDcpLn6n4+GXtxSp4=; b=ZfbJ5PpQnBpubRUdqHkRJ/q2ajEqIvbQaHx8+JUL0ivXsDoEnj+myEeMcLJuNOyhPl lAxY9c4fqe0SkJTl4qdzA4uAMakKo3K5yM+SQTLkUIui47LDWn8TcBZOgJ6YcL4U3zMy zebmroU9p+yEU7/wL7GVUkiDaXtFfBiSBTiENDtp84NWvqvC7EHf4Buq3vlpXBHnXqj0 7792Pirb2CDrdiHxqK+JHelnTVH1Yn+7+k9yE5jad4rBhvw5mnmpCXdvfTvEw2XbQZSX 8p/XCDWlO3kO1G/BKiUMgKCP6cdLXD2X7/RBOkuNWMbnmWgKdPRfjIeh4P8bLcp5017/ tKTQ== X-Gm-Message-State: APjAAAVwOzzuu4XgKUKGCq7vffqR6pROFdQB0WsocTDo2Cxi504F/F3Q Lb9pZM7Gj30ilgWzoOMQoL74aA== X-Google-Smtp-Source: APXvYqze5LN3aOYXNKPoCOLDmEUX9QGs4hE002KDZjaA3OqHx2iSBVAFWttbMcpdwF3gW9tOhOhlqQ== X-Received: by 2002:a1c:ac07:: with SMTP id v7mr2388930wme.49.1556180804571; Thu, 25 Apr 2019 01:26:44 -0700 (PDT) Received: from localhost (mail.chocen-mesto.cz. [85.163.43.2]) by smtp.gmail.com with ESMTPSA id 17sm15749878wrk.91.2019.04.25.01.26.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Apr 2019 01:26:43 -0700 (PDT) Date: Thu, 25 Apr 2019 10:26:43 +0200 From: Jiri Pirko To: Vlad Buslov Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, davem@davemloft.net, jakub.kicinski@netronome.com Subject: Re: [PATCH net-next v2] net: sched: flower: refactor reoffload for concurrent access Message-ID: <20190425082643.GA3951@nanopsycho> References: <20190424065331.31046-1-vladbu@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190424065331.31046-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 Wed, Apr 24, 2019 at 08:53:31AM CEST, vladbu@mellanox.com wrote: >Recent changes that introduced unlocked flower did not properly account for >case when reoffload is initiated concurrently with filter updates. To fix >the issue, extend flower with 'hw_filters' list that is used to store >filters that don't have 'skip_hw' flag set. Filter is added to the list >when it is inserted to hardware and only removed from it after being >unoffloaded from all drivers that parent block is attached to. This ensures >that concurrent reoffload can still access filter that is being deleted and >prevents race condition when driver callback can be removed when filter is >no longer accessible trough idr, but is still present in hardware. > >Refactor fl_change() to respect new filter reference counter and to release >filter reference with __fl_put() in case of error, instead of directly >deallocating filter memory. This allows for concurrent access to filter >from fl_reoffload() and protects it with reference counting. Refactor >fl_reoffload() to iterate over hw_filters list instead of idr. Implement >fl_get_next_hw_filter() helper function that is used to iterate over >hw_filters list with reference counting and skips filters that are being >concurrently deleted. > >Fixes: 92149190067d ("net: sched: flower: set unlocked flag for flower proto ops") >Signed-off-by: Vlad Buslov Acked-by: Jiri Pirko