Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3632imm; Thu, 16 Aug 2018 14:21:32 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx/qpE2scdZGR0r6xPOrcxeKqljPEuEhtZrBjzQdtaDdeokc+k6E85WYHs1fAOKB7lWv+qT X-Received: by 2002:a62:9849:: with SMTP id q70-v6mr33605017pfd.178.1534454492659; Thu, 16 Aug 2018 14:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534454492; cv=none; d=google.com; s=arc-20160816; b=T1czIqy7xfIRGd1NzFqT/fjN9xz/vuUhTBJ3WYjiTlOI7huMiWbwWlM68NuBaQ66g0 p2UG/uMuH5OqKJtvP1CvVuRzcqQAeQp0HbCQ7tD3x6aB0MW0Ei6MjtvrA1z6/O/Bhdj5 qKRIeVYA0+QrNawOM/H91xsjr7XxlC2d9TMKaA/hCVMCNg2Coh9XFo3ISheOVA2kdla3 +ReOwaVq91LTVOSMV6o80Mq+flmfBHymzSoESW4LetB7N8CCLY7Irmj4EfGtEn21DgQt c6pfTC9M6+5W0bpssvgjvxUiV9idD9guMX+TLsh2ssHW2+Efvlh3R4o/ajF7RORatoZE 0Zxg== 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:arc-authentication-results; bh=GV7MLnKSSKkwmYSbeFUjXakbD8pfo4B7R+wT1iY5rpI=; b=KNOp2wI1QvbcMk8jLElg33J9qTtr8Jnu2FcAUNWU9gjs90NkjKyZInn7bKKaVo7F2u dLdoVfOPxTnHQh5Rhj/lTx2NMo52yb7iMRnYyqJlZVIAopRDnuxw78U0EkpP7iJ4JA7g oPO74pWeta/5tnARObC8fC5e1y3FHRsd7iFP8Ea+yXiCwfy04WiWE7FS4WtxTY8xd5p/ x8/8+CZrOZ5eOH6ixRrmFYm+B44JoaGiW7s0QAZ9DtJPzdbnGNH80SpNc0/opty8LeLk MwuT3pL+3n+Ytvpa17winIU1YY07jC0Ae+016k2AkVZWc0jsZG10w+U75FgQLpF7Y62V Vg3Q== 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 n13-v6si344086pfd.50.2018.08.16.14.21.17; Thu, 16 Aug 2018 14:21:32 -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 S1726127AbeHQAUz (ORCPT + 99 others); Thu, 16 Aug 2018 20:20:55 -0400 Received: from mail-yw1-f48.google.com ([209.85.161.48]:41079 "EHLO mail-yw1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbeHQAUy (ORCPT ); Thu, 16 Aug 2018 20:20:54 -0400 Received: by mail-yw1-f48.google.com with SMTP id q129-v6so3658232ywg.8 for ; Thu, 16 Aug 2018 14:20:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=GV7MLnKSSKkwmYSbeFUjXakbD8pfo4B7R+wT1iY5rpI=; b=ix+z3A2wwIUwSpd8uzV568+MacAUqel7e67aoMFJ+N+ApMVHKCthU8F4lpAhYeihDT ftCCJ7lMW2rtqerLQIE/6xE2Id1Ah8YzFnEKTafcw9TKdgtjY0W2yRN+dearzIvnlSYI QESPkvt7sUaHb7brFH8G6zlEbzFhd94ZrTfeQ0U5MQ+nChmuTwwjygXaJqIvuLEd/59j FoGSYuXGfbd/56UuWOAMNJsgaEOIabtDqhZyx8rC4k3sOlkFDlIoVKHarhsMHk9bubSK yjdhU7v12lhqeoKZ+dIGt/dRFn6jJeaPpOcyAZuCOHXaw5NOKcUfLO+XmvGnpxw7vRqf 8l+g== X-Gm-Message-State: AOUpUlE5Hp4KUdRBPKUkxDSoCZxrN3a5Ec52MpcK+Q8VTyGB/9YHDv9d v55hMbtzerLbfLJlN3BYYfQ= X-Received: by 2002:a81:9ecf:: with SMTP id v198-v6mr18410678ywg.201.1534454411651; Thu, 16 Aug 2018 14:20:11 -0700 (PDT) Received: from ?IPv6:2600:1700:65a0:78e0:601c:55dc:cc7e:5472? ([2600:1700:65a0:78e0:601c:55dc:cc7e:5472]) by smtp.gmail.com with ESMTPSA id 64-v6sm140565ywg.106.2018.08.16.14.20.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 14:20:10 -0700 (PDT) Subject: Re: [PATCH v2] Bugfix for handling of shadow doorbell buffer. To: Michal Wnukowski , torvalds@linux-foundation.org Cc: axboe@fb.com, hch@lst.de, keith.busch@intel.com, keith.busch@linux.intel.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, yigitfiliz@google.com References: <20180815225157.89523-1-wnukowski@google.com> From: Sagi Grimberg Message-ID: Date: Thu, 16 Aug 2018 14:20:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180815225157.89523-1-wnukowski@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index 17a0190bd88f..4452f8553301 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -306,6 +306,14 @@ static bool nvme_dbbuf_update_and_check_event(u16 value, u32 *dbbuf_db, > old_value = *dbbuf_db; > *dbbuf_db = value; > > + /* > + * Ensure that the doorbell is updated before reading > + * the EventIdx from memory. NVMe controller should have > + * similar ordering guarantees - update EventIdx before > + * reading doorbell. > + */ > + mb(); > + > if (!nvme_dbbuf_need_event(*dbbuf_ei, value, old_value)) > return false; > } Reviewed-by: Sagi Grimberg