Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6560908imm; Wed, 27 Jun 2018 09:29:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI8+MOQXdVI362kowadcHi49c1/1lEnHOxZSSAiZ6/XQ1r/1hnqR9mUlNMBG0sN5/dOb/Rq X-Received: by 2002:a63:6004:: with SMTP id u4-v6mr5772685pgb.441.1530116990894; Wed, 27 Jun 2018 09:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530116990; cv=none; d=google.com; s=arc-20160816; b=SPiHS/KyWGm9yBTfq2Pw9pX74+wVrMrVqMqJC4sWX55hHCt8hCv36BoaTZgycBHmyB RiV18N1w3V6/3RKK1lyhoPyU7vMt5KylVUDtzSkdxzGeZyaGEb2OzTaQjwadH3CKRQnO k0reDIfgdh8rBqCJ/K571c+F4Jjy7mQMHV39XZ5lp4Ov9ZXF5osViEsmLYiGclGLbTy/ id10cajuSSFTMe4LsrK/hMA2UGtupmHwqvOTjzK0S7TxpyhCojsrXPrGdhw8jCIeb8tF SmCUSXLhZKl3zIT/dhVEUVCL9+tbghd7889z/xuj8cQMAdqy1wwCmw8cFw7/QMw9OLH5 byJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature:arc-authentication-results; bh=ZJ2uetk9Jjb96gqgpah9GrmvQLR3FdgYG7Nm7CZKMIw=; b=oaDXfS+8ehyHdl/z0bIzbVZyZgshBGrNcu5T179eo7DdoqFQ5uIhIN92L5fm+u4QcR c2rUHeH7LcvmlEsH+UW2I7hMyzG2n6yEYzcr6qdYKS5MjZDm4JFH24U3vHlxUTOP1uyH LvCs+RN1rNHhs87EW89S8JB1uQPzachwYewdS2kRlMFVQz+BnhnNJbC8bbPysT1Mk0nl xFYjFSWvs7djvjMuoVvBbsuCLGzeGBpzzE5Yi9Ep+3t/mxGkT4DWkhaCZxWa8NwCm/Qy VRwcetRf5gomtEB0w2qMAvYTAamDvv+xUcFJfo8LoyeDWzQVegiY+6yJbOB1eq2ypJeD F4OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Yeo2ergC; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l23-v6si4639725pfg.326.2018.06.27.09.29.22; Wed, 27 Jun 2018 09:29:50 -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=@broadcom.com header.s=google header.b=Yeo2ergC; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965052AbeF0OqL (ORCPT + 99 others); Wed, 27 Jun 2018 10:46:11 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:33582 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933080AbeF0OqJ (ORCPT ); Wed, 27 Jun 2018 10:46:09 -0400 Received: by mail-qk0-f195.google.com with SMTP id c131-v6so1172868qkb.0 for ; Wed, 27 Jun 2018 07:46:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:from:date:message-id:subject:to:cc; bh=ZJ2uetk9Jjb96gqgpah9GrmvQLR3FdgYG7Nm7CZKMIw=; b=Yeo2ergC/SEj/CWQ/SlEm+8/se4AqyTGS/vi/AZ18zyYlQTzkJvRog1r+jnc3m+dZp IVXvNR+rE5AGZ2Uu/0t/t+Ag9YdQEuHnniMBx0E9xdnlocpyjtmBAoOvL6z3MFcZbGQl gtABnC9WoEpKZpzqi+I3PLIjR2Epp47iluxaE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=ZJ2uetk9Jjb96gqgpah9GrmvQLR3FdgYG7Nm7CZKMIw=; b=lLj41rPE6p2MqUmrkxz003UXPguvEzF8pcdafg2C9jZFpALghUMqVmmvMpjUHb7HJ0 gcLGeLjOwa2ImdROQS2vDNu5p1LeZl36GbRFu7DdA6EpOSXXgePArDe0Vn10/JmKYKb8 p3NPkdcdDCgmJePztFYxHY2qu7qMXTDQHTrsxYaTd0VMJb1DqbtGc0NUQModJK0qm/jc mcrAuxHmKT8xrjOkXSnFw+koyUTUC7Bs/3DPynEjg3Qv2sutlmOVIe6RWkM2mjg/2Alh MeYnG3de6THKrMxRBylSh6Cd+mD11pYaVbnMNhqADqAtobIp81Go9Sh3cpMV/7M81X5e /xUg== X-Gm-Message-State: APt69E2X4POC3H45ruHZ4L0Vk5vIiMDr4x9/Cu9bU2dCIAP4zwssXKT+ eObWTGC7Ps8FOwsv5/AkJAVsaDOkHhjbWQm8e7gWnw== X-Received: by 2002:a37:5bc6:: with SMTP id p189-v6mr5428549qkb.212.1530110768999; Wed, 27 Jun 2018 07:46:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aed:3267:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 07:46:08 -0700 (PDT) From: Siva Reddy Kallam Date: Wed, 27 Jun 2018 20:16:08 +0530 Message-ID: Subject: Re: [BUG] net: tg3: two possible data races To: Jia-Ju Bai Cc: Prashant Sreedharan , Michael Chan , Linux Netdev List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 27, 2018 at 7:17 AM, Jia-Ju Bai wrote: > The call paths in Linux 4.16.7 that may raise the first data race: > > CPU0: > tg3_open > tg3_start > line 11611: spin_lock_bh() > tg3_enable_ints > line 1023: tp->tnapi->last_tag [READ] > > CPU1: > tg3_poll > line 7341: tnapi->last_tag [WRITE] > > The READ operation in CPU0 is performed with holding a spinlock (line > 11611), but the WRITE operation in CPU1 is performed without holding this > spinlock, so it may cause a data race here. > A possible fix may be to add spin_lock_bh() in tg3_poll(). > > ----------------------------------------------------------------------- > > The call paths in Linux 4.16.7 that may raise the second data race: > > CPU0: > tg3_open > tg3_start > line 11611: spin_lock_bh() > tg3_enable_ints > line 1023: tp->irq_sync [WRITE] > > CPU1: > tg3_interrupt_tagged > tg3_irq_sync > line 7341: tp->irq_sync [READ] > > The WRITE operation in CPU0 is performed with holding a spinlock (line > 11611), but the READ operation in CPU1 is performed without holding this > spinlock, so it may cause a data race here. > A possible fix may be to add spin_lock_bh() in tg3_irq_sync(). > > I am not sure that whether the possible fixes are correct, so I only report > the data races. > > > Best wishes, > Jia-Ju Bai > > We will evaluate this and provide an update on this.