Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1199507ybh; Sat, 3 Aug 2019 20:26:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnubwQP33h495fEQrBtHpdrgGbLZLW1SouZa1K5aCL91w1O5Y3p2pxCTGV1O6gsEYjyKs0 X-Received: by 2002:a17:902:8509:: with SMTP id bj9mr139780746plb.79.1564889193524; Sat, 03 Aug 2019 20:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564889193; cv=none; d=google.com; s=arc-20160816; b=NXgeVg5E8weOXPZiObsF0GOlR6xiZiZrfxZf/TcSW17vqfX0pKRJIOxwT1ZNwVdMEA FTtDHS8AdreB2Ln+A8UCuA9YOP+GDbWi74k8Yo6VACApJ2gazBBcIwc5lYfB4xzv2bLl J9NWNjbgzz77ZQLx0dd4T1NUSf87vy1W2AB/YQnOpX96r7gutpuIeiq8GZoetXPuVMHe d/gZ3uthev6r/aZVcxu2ZnO56/qj4sxgtp3LikOUmHG/F/rbzye8BOSgxIslrbxl6688 zuh6GjHdbrRpwp1ON+90pyhS+oK1/n5H6n+qbiWYO3OhSZENPOGMjh2UYIxoHp6vyssd /MAg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=o1vMxhl+4Xe8qt/aHo+GhoXoYmWQszbPFJSU0NitREQ=; b=pPWN3cgHpbWujnHLj/6QKsz6vnMnGnSzeoKf4P75BISB/+iVZc9s9OF/2TP/QG6oMw xGhnJvtJPbbm+X6wYkJhi8nK9LGUSkFJWBoC84QWT89/eKLQVAjodSnFKue+QYHUdcdg UQR+Tq63V3bLKjmIDC/GwUKGujQLeNjtjxnsegjV9cRoag6EtL6pY5nMhpjzvByaRRcN EWyFTHaAFrQ+Z6s6KZz68ZHU4mQgcyY2cwr29TB/4qO2FAyQYTP+L+IghzgI/lpZOVbe qvEDck2Gghifv4lPPxB9zWiex4PbKDB/weX7+D29y4ZW0S1z29qcTR01LXR0SX1FGF77 U8LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VvHc2KZk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f69si9583717pjg.43.2019.08.03.20.26.18; Sat, 03 Aug 2019 20:26:33 -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=@gmail.com header.s=20161025 header.b=VvHc2KZk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388594AbfHCCmp (ORCPT + 99 others); Fri, 2 Aug 2019 22:42:45 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:44154 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387492AbfHCCmo (ORCPT ); Fri, 2 Aug 2019 22:42:44 -0400 Received: by mail-ed1-f66.google.com with SMTP id k8so73977004edr.11; Fri, 02 Aug 2019 19:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=o1vMxhl+4Xe8qt/aHo+GhoXoYmWQszbPFJSU0NitREQ=; b=VvHc2KZkDBdebb6X8/gGkQvTDaYUvh/XU5tP/42xt6NVPTfjJOyNyL7/9fNgAZrgih 4bryokS8g7RSJX8RY9r/PeWkPp029rbVwLGpnPHk9eJjZJaAERVj/a/Qz044hf+rfumc 8phV03Gl/qpN2BKLJUZlHL+psH+2XaTBVG5UVIGmhXKk8atykWK4GNYigxYmyYFZPmnT DBsENi0ZOO8AfcUmET3/yFiCQi+/ZGrB2YQ1Hp6cEGTCFRI9AhDpnDYIkTwvweQ5g8dZ LwWvPDUdixr4iznREIccOOtKVx8W2x1PG8RCDWlKjfu2EslcUlR5c6fmhizqCJCR3Txh Xb1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=o1vMxhl+4Xe8qt/aHo+GhoXoYmWQszbPFJSU0NitREQ=; b=ogt5up4vX/Glo3QVlnXztfmlllrFnOtV5AOwhWO1PZGyaqJVm/Sk/BeNKkdZx3mB67 4sHcAMLaE1Oq04P97uz1KGGYmwduaupBYHagl7H71MTKxhoND/Ksu1s1+4bryNhW7YWg +K/AeJOgoMhqvk5lZBy4rbp+3doxYFeZQ+uNGQ+lfNNxGv4EtrS7t8/WXTqNFzKbZ9ev s01K0X9IXHOlo0Z9Yb+y2IEY4wIFPoHev+p3iTgabTeIUGe7QB/JJfG6huln0qZzjoCr hXXtpQ/qA8irI5LEjTPwVZQnXa270DATAu2JgFOkPDK/2h6PIjL23WBXiTL9/8cL3zpg IsxA== X-Gm-Message-State: APjAAAWnV38dtcVntxBKky+sRGsLX/kMApM6UMCvBNCdU/1NMUKu/0Zz uw4bxF3/o8/Vt4COt3+mo9fFJTIyioRjnqoOK+k= X-Received: by 2002:a17:906:32c2:: with SMTP id k2mr15739979ejk.147.1564800162874; Fri, 02 Aug 2019 19:42:42 -0700 (PDT) MIME-Version: 1.0 References: <20190802121020.1181-1-hslester96@gmail.com> <47bb83d0111f1132bbf532c16be483c5efbe839f.camel@mellanox.com> In-Reply-To: <47bb83d0111f1132bbf532c16be483c5efbe839f.camel@mellanox.com> From: Chuhong Yuan Date: Sat, 3 Aug 2019 10:42:31 +0800 Message-ID: Subject: Re: [PATCH] net/mlx4_core: Use refcount_t for refcount To: Saeed Mahameed Cc: "linux-kernel@vger.kernel.org" , "davem@davemloft.net" , Tariq Toukan , "linux-rdma@vger.kernel.org" , "netdev@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Saeed Mahameed =E4=BA=8E2019=E5=B9=B48=E6=9C=883=E6= =97=A5=E5=91=A8=E5=85=AD =E4=B8=8A=E5=8D=882:38=E5=86=99=E9=81=93=EF=BC=9A > > On Sat, 2019-08-03 at 00:10 +0800, Chuhong Yuan wrote: > > Chuhong Yuan =E4=BA=8E2019=E5=B9=B48=E6=9C=882= =E6=97=A5=E5=91=A8=E4=BA=94 =E4=B8=8B=E5=8D=888:10=E5=86=99=E9=81=93=EF=BC= =9A > > > refcount_t is better for reference counters since its > > > implementation can prevent overflows. > > > So convert atomic_t ref counters to refcount_t. > > > > > > Also convert refcount from 0-based to 1-based. > > > > > > > It seems that directly converting refcount from 0-based > > to 1-based is infeasible. > > I am sorry for this mistake. > > Just curious, why not keep it 0 based and use refcout_t ? > > refcount API should have the same semantics as atomic_t API .. no ? refcount API will warn when increase a 0 refcount. It regards this as a use-after-free.