From patchwork Tue Aug 29 17:34:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 9927819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E290A6022E for ; Tue, 29 Aug 2017 17:34:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEC31289CE for ; Tue, 29 Aug 2017 17:34:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C11CC289D0; Tue, 29 Aug 2017 17:34:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C9A8289CE for ; Tue, 29 Aug 2017 17:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750868AbdH2Rex (ORCPT ); Tue, 29 Aug 2017 13:34:53 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:34280 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750815AbdH2Rew (ORCPT ); Tue, 29 Aug 2017 13:34:52 -0400 Received: by mail-pf0-f182.google.com with SMTP id l87so2302822pfj.1 for ; Tue, 29 Aug 2017 10:34:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=B4lVjhYqyo6irsgEE9y1zOIbhPUCqI5i2DvAX5us6g4=; b=mZ+ZBjT1ay4bqDWo8XA+7CeipGmmQkmZyFn0gwXnCIMTBy4q6soXJfKpfAGDXKd8A/ aEQSelIor1sEWOcfMEb+6WkEPLG4wtusRyI5oClqIKBA8zU1ZqjYcITgRkVFFrBcWruX G8Zfdg53EDNAiDwCYS2Vib3ghni4B6WJm06Po= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=B4lVjhYqyo6irsgEE9y1zOIbhPUCqI5i2DvAX5us6g4=; b=F1wqLFelv2zmMbsas5wl3G1BdcFimdoZA74hTk2MKVP3J96H8NG8YXo8OxCOz285ZD i6mjHTQ88exPzMqzUGYSNlTwH1kEOYAnpObzIANXQi1bpAk6zZb4Be6hRPksmcpiiFjQ VjKuP9TWA8A44wlk6zGS8mLP8gbgAtQWGsQKMHnRTYAV1jsdhquDzZ9SgqmtRkFZuLhV SfuhanQmd0/uLV7I+xnl2RP8T7a11GUpn/5LeV9uAscvZCGfJdRciLJ4clofhhNoeZKF 51k1CZxcr2Ic9X6WZDBPkt1mjgblpWdTAeH+Uge/cp17y4OFbLgW6xq1ZC+erY7T8edt ZmMA== X-Gm-Message-State: AHYfb5iS2zUsPiKLaXQGOZrbqqEwIfhu9uZfNNWzT3b7jPwgnQIU6nC+ hxxgMQureFyeLTlH X-Google-Smtp-Source: ADKCNb7m3eZeomYx5e/ZY/fmToWavR+wXslSGP0kt7Ygrb9276Ztb6jwN9Bb2fQ8qX2UW/AEmZ48wQ== X-Received: by 10.84.224.205 with SMTP id k13mr1337288pln.203.1504028092472; Tue, 29 Aug 2017 10:34:52 -0700 (PDT) Received: from roland-x1-yoga.home.digitalvampire.org ([2001:470:1f05:221:9810:34d5:f833:73ce]) by smtp.gmail.com with ESMTPSA id 128sm5455110pff.62.2017.08.29.10.34.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Aug 2017 10:34:51 -0700 (PDT) From: Roland Dreier To: Doug Ledford , Sean Hefty Cc: linux-rdma@vger.kernel.org Subject: [PATCH 2/2] IB/core: Add might_sleep() annotation to ib_init_ah_from_wc() Date: Tue, 29 Aug 2017 10:34:44 -0700 Message-Id: <20170829173444.4289-2-roland@kernel.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170829173444.4289-1-roland@kernel.org> References: <20170829173444.4289-1-roland@kernel.org> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Roland Dreier For RoCE, ib_init_ah_from_wc() can follow the path ib_init_ah_from_wc() -> rdma_addr_find_l2_eth_by_grh() -> rdma_resolve_ip() and rdma_resolve_ip() will sleep in kzalloc() and wait_for_completion(). However, developers will not see any warnings if they use ib_init_ah_from_wc() in an atomic context and test only on IB, because the function doesn't sleep in that case. Add a might_sleep() so that lockdep will catch bugs no matter what hardware is used to test. Signed-off-by: Roland Dreier --- drivers/infiniband/core/verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index b456e3ca1876..84868f76f8b9 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -478,6 +478,8 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num, union ib_gid dgid; union ib_gid sgid; + might_sleep(); + memset(ah_attr, 0, sizeof *ah_attr); ah_attr->type = rdma_ah_find_type(device, port_num); if (rdma_cap_eth_ah(device, port_num)) {