From patchwork Fri May 19 08:33:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rangankar, Manish" X-Patchwork-Id: 9736473 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 866286020B for ; Fri, 19 May 2017 08:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6342C2878B for ; Fri, 19 May 2017 08:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 569A6288A7; Fri, 19 May 2017 08:33:43 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI 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 CB4172878B for ; Fri, 19 May 2017 08:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754617AbdESIdm (ORCPT ); Fri, 19 May 2017 04:33:42 -0400 Received: from mail-sn1nam01on0087.outbound.protection.outlook.com ([104.47.32.87]:32544 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751329AbdESIdh (ORCPT ); Fri, 19 May 2017 04:33:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=kWfBbNMiUXfyC5ZgrYN+kr40Jr5TXg2VZOq/4RyxKIg=; b=ZQhebigPfO4Wwl6Ut0ymR5oo5aw/XMm2lkX1yh6yLHZ54MCTC0UpBEa9p1vlzut9o+1Km7o5zoVP/lHJJoHsXk7+A2V/swdAT1NSJR8I86uEUSLKHA611aZgcd5cK/BpTrah2TTZAx1uXoR5J2N4woPvxFa4nl5qMPLaF9iJY/o= Received: from CO2PR07CA0049.namprd07.prod.outlook.com (10.174.192.17) by CY1PR0701MB1581.namprd07.prod.outlook.com (10.163.20.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Fri, 19 May 2017 08:33:34 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::124) by CO2PR07CA0049.outlook.office365.com (2603:10b6:100::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Fri, 19 May 2017 08:33:33 +0000 Authentication-Results: spf=none (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.1075.5 via Frontend Transport; Fri, 19 May 2017 08:33:32 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Fri, 19 May 2017 01:33:22 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id v4J8XMMg018069; Fri, 19 May 2017 01:33:22 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id v4J8XMxJ018068; Fri, 19 May 2017 01:33:22 -0700 From: Manish Rangankar To: , , CC: , Subject: [PATCH 1/7] qedi: Fix bad pte call trace when iscsiuio is stopped. Date: Fri, 19 May 2017 01:33:15 -0700 Message-ID: <20170519083321.18030-2-manish.rangankar@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170519083321.18030-1-manish.rangankar@cavium.com> References: <20170519083321.18030-1-manish.rangankar@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39450400003)(39840400002)(39400400002)(39850400002)(39410400002)(2980300002)(428002)(9170700003)(6666003)(4326008)(72206003)(38730400002)(107886003)(50466002)(50226002)(2950100002)(5003940100001)(189998001)(80596001)(36756003)(54906002)(478600001)(50986999)(2201001)(305945005)(105586002)(8676002)(76176999)(42186005)(5660300001)(356003)(101416001)(48376002)(8936002)(87636003)(86362001)(106466001)(81166006)(2906002)(33646002)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0701MB1581; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD018; 1:aHDI8JktLYu0F5GG7H1NuhV2qQk6qNkn6s8QqdCcg17XVKghOv8f84AAk8I5XYb3x7wz5C02Fuak/VLl9q6YGCPvqVstV7TQMuTJSuVX1R++fEK8MH8zplwifYOOaFPAtmYiDoPZInrlvs8sgj9WiSJy9jCZPPFUhMFcpA/9nTO1hZqDA810tG2+U8RdkJHCy3vGtkCwaVgHHPQXK00IfrcSzpOBR7SlueglQdUNvkV7nFw58ub0A26YhhFyynDCq7mUj9xen7X/Z0Rj6I8DrwJ2dIaQ+fQkkQduIMJtssuliXnHV+37iAqxmZusFq4Ggyl/dYfjr5FD9Vq2sW1IBfa7hqlP2HbQNyiKt2ScLqtqtkZpeFy45+FER+ulS52d95waOhOE9mEGdwXivb14a9CIV/13ZmFo+ZPKDKiqsaTKsVlYgfbYkvN5k/g464BN8TZ0SOWdUo9V3V1iRLwnk1rxFAo7y1l1M2tgzN8NW9nARwYRkS3ZCkwCgUhxos7WwfH97XkH4qeHLbD15pvr816EMlrCEwwQ0o8H1Wtzyr0= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR0701MB1581: X-MS-Office365-Filtering-Correlation-Id: 7b81d57f-c985-47fc-14b2-08d49e91bc30 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:CY1PR0701MB1581; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1581; 3:LIwFVMjvoC2eLsmRvi3B02j3tCDB6VnbMa0icTLi6No99LxHAxTeQR7jA1m1UeiWNaj+efClWO0rHfODZd8bzDzsxAwI9nAqeDs7or89WfTv0dD6pAKubwqveWkLEsyOQ3H44xoCHlRC87X7XsyJ5MFQB3V4P846TpAsrac0A81L9VL2ZA7PES9kNtJcOJHnzegRStnCW0eIeyxgX0ZEJ5mAWW2VXakBMy949Rsj5DuvEzrVaK7RFyQshWwSHhihOmj0/6WcmUxL5KuVIGyKzEeP7E6m19magcPtv+21XVU3vb3BWnv9Ti+6g0EB4GtlXJzMEpyxAOZeBIVVQPrdfDYylPd/AntvsANxQXjgVxgUy+MnZEzTDH69/H544O3YiodNUWeIkrq7LbvM0lH7EsyLO9Va3caotz6FajYGmUN8/iBQc48+DFooTZ5vSGoUWs3KBmpdz+kO8WTpGqJTK8uQqVtNxXTVy9PNXi6FjOb53G0i0c0OgOr0JHvJUdrR X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1581; 25:UGz0Aj8RWunJnKmkemZIrLLqab+19sqnYTI3V1D3K1xyHvj37Kk3IXW0KvlbyCfY7qXmB8AEbVlcGTP0ZfTdI6x2ISNklvOb/Cnfh6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gB0pl0NXdo6FMFEUswcXTTjEQMAMbIKjPkYgpyS4VqGp707O09KDryUwjwXT8trFO092bdTypoOAzjAU+JlDTzuGcPUqxEo0N9dBs5jHVnMsWfJmfKR4iF0 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(8121501046)(13017025)(13015025)(5005006)(13024025)(13023025)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR0701MB1581; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0701MB1581; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1581; 4:I5aWar5ZsEWqBgXyvDYAi6MMJRpqJbwl8Rtl6kovDJgKUsnRB8mtFIOLq07uDtA0rkJ7zzQs5efkIdMYnTerSMlJplqyHX6Bfy6ghdhbMl2ghuiBFkm7emTX62M8IImtCYRhEilJNx3AO1Ld4Et8r6OWrReVZOWzOL0VJb7ZsMctt7FZCNi1tAfF+vMpI7FmDg7XxKwBv3wI9SsmnLSmZ03qZtJfuV3gK11F0nepl2/uTN5ATfXwDNqWWaOL2hKnBI45VIxVOX0gM6/1mH84sGkL5X58cQKufeTKSNXwaFQ7vFalUuGM8QXgKrjcrjfejxCc/SCbpZCiT+rfkjVIeOF6tJ4h+SIL5nUzBmZslnw4dzXFDSE5KhD+Lg1IJycMDeuXN4DLQXfLSOHgUcrEDKR+F9+OlqbzeYp382fJvbf9xmkblQqPEmDq2tmMwtLzJcAoC68QdsAr3SX9QPh5O+0Jzty6wO0zXuJaA2Qk93w51P86j5WoW3QAYfwFzOi5A0vZ3q1ITm/2yyTumB1cIHDviL0dLC6+p07D6y4z2wX+QU7UMwgGMMlKOSYen5GnFT881eWH0iH26hyGUW/TkQEAvMN60xTvlhmX2aIufC6/E/5C0jgJ41JEO67xRFZ7/o/TlDzzJ8ofTGcoJ441cX0s9M4aA3S24Il0Dosqik+Tpb15cGnLbtqBybeAhWBGxXE9jXhswVeblZwR9T5d0KU9hQfiH8f0EwkegkD8aHakdjilqNGANWueevPKCzUje6aEH4oikHR7Y9eOfE1n2Lavhxo0uzYWGKIeyIh9puy/pePxkBOfBBjtfCIArkDexc7h7JNUulfmQI1ZbxiTcD2QI2Q+1NHQBvmRks241VlSEBwdcCRtsfFClZh/NhPd X-Forefront-PRVS: 031257FE13 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0701MB1581; 23:AhfISTnGEy6AkcDx+4xwS2uxGZcrNZo9sshVXNA?= =?us-ascii?Q?wnxxQURnqaiaugwa0ombky+1ugUZdMscQQUyJiRl4uYG7PSen47u43l7mecL?= =?us-ascii?Q?F7BsG749n6WtPBYr9VCdZr6l35KHYZK9EgOveQrlZDOc+eEIMHdmIAoPDPeX?= =?us-ascii?Q?aUrbB0rrr5oFAJjGCXHq/krq0Rc3KT9OjAh+dH+5oSmsn0wMlw7tyZLI/z0P?= =?us-ascii?Q?qX/Ts+btfERwmNOc4pfzc+Mo9OlC1rvqje46R5nIORP3LONEj5asJ21Zk7KU?= =?us-ascii?Q?M4QWIgd86kB/XN3cV0p4dAhUfLwRnK149dE3HcWzuSvOO7owfVnfja0iTw5F?= =?us-ascii?Q?Oz/O3VI91h3kswKHHKI9oAz2bVYL6h8SQIZodxn+gpBQKW7C+9UoFxjSe6SQ?= =?us-ascii?Q?Jsn/84ReRooqAvzbHzyV6n/MOyGxcsTXFYS1EpNhSVnazHOf+vKpz286DKpw?= =?us-ascii?Q?CQYruoyRa6X7dtKabsMgyE6SoHBIbK6+umX62v/K67KSpfKvADr43WxeARPE?= =?us-ascii?Q?0QWBPiQxZOfnkuQrvBxzJeFYVwcL/1PN1avQJYwtUZ1/fKfgArS2lvmqJvqs?= =?us-ascii?Q?vRcCllTyfCE0RTmt/ngo4LdkxiV7vbrPr3h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BELt/Zbbgwr2W1tmhOPN1O5JSwEY06MDlW+q4EqpelifEFFzOxW+M4eIeJtforAYj5XW0DsEYHRVuzDFGw==; 5:7pcNpqeppNOHmh2LCJhNxBAktCZFLtJ+7SZo38PueCG9MhBTA1g3eFrYPA7+FO46f8qZPOAG2Dp6PI/QK2sNXdPPAFUVeTi5NltsS7geavHKtEjbH+oabUCBPMG4Rfp5zcw25yHCKqIHwDFNwko3vw==; 24:M94GXwT4mfNoNvk/ewvXMZuFLq3mqe+l5qJ1VDkstVBOgwYFaa0lA2NzntcNP/50vTkA/bTCH+jXTmaUvYI9JOv0S6aeBejtcoXfB49I3xY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0701MB1581; 7:RER3HjO+k+oe8H5BSW/MtY6kjMxnNrt74nMR/FjpZPwEskvT3TNqgpBzxDXfIcN/AWculj6cMr3q9r1r4d27cGa0ZzhdznW3k0YzxHvLi47dK5n9iVPLhV29rF/5RVw+Id98XKiUHxu/vGmQ3LMeiL4AC5EpKuWEUOQTQRV9SN7uEnAB4QIExk9Vf1xZI15vHvBRCoGGdZZiwGdEVx55LqRliv2tFfVI0ipBF16BdAPcrjOdudL5N4pRC7sZin/hBfpClAIUC83v3ShtqrnxyMj1GZjOOOz7wf2nYglCooljQhIRxf6R6zHHsWcFroJlGpUfBZ0hulR2c4ZRAWCpTg== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2017 08:33:32.7208 (UTC) X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0701MB1581 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Arun Easi munmap done by iscsiuio during a stop of the service triggers a "bad pte" warning sometimes. munmap kernel path goes through the mmapped pages and has a validation check for mapcount (in struct page) to be zero or above. kzalloc, which we had used to allocate udev->ctrl, uses slab allocations, which re-uses mapcount (union) for other purposes that can make the mapcount look negative. Avoid all these trouble by invoking one of the __get_free_pages wrappers to be used instead of kzalloc for udev->ctrl. BUG: Bad page map in process iscsiuio pte:80000000aa624067 pmd:3e6777067 page:ffffea0002a98900 count:2 mapcount:-2143289280 mapping: (null) index:0xffff8800aa624e00 page flags: 0x10075d00000090(dirty|slab) page dumped because: bad pte addr:00007fcba70a3000 vm_flags:0c0400fb anon_vma: (null) mapping:ffff8803edf66e90 index:0 Call Trace: dump_stack+0x19/0x1b print_bad_pte+0x1af/0x250 unmap_page_range+0x7a7/0x8a0 unmap_single_vma+0x81/0xf0 unmap_vmas+0x49/0x90 unmap_region+0xbe/0x140 ? vma_rb_erase+0x121/0x220 do_munmap+0x245/0x420 vm_munmap+0x41/0x60 SyS_munmap+0x22/0x30 tracesys+0xdd/0xe2 Signed-off-by: Arun Easi Signed-off-by: Manish Rangankar --- drivers/scsi/qedi/qedi_main.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 92775a8..997e305 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -151,6 +151,11 @@ static int qedi_uio_close(struct uio_info *uinfo, struct inode *inode) static void __qedi_free_uio_rings(struct qedi_uio_dev *udev) { + if (udev->uctrl) { + free_page((unsigned long)udev->uctrl); + udev->uctrl = NULL; + } + if (udev->ll2_ring) { free_page((unsigned long)udev->ll2_ring); udev->ll2_ring = NULL; @@ -169,7 +174,6 @@ static void __qedi_free_uio(struct qedi_uio_dev *udev) __qedi_free_uio_rings(udev); pci_dev_put(udev->pdev); - kfree(udev->uctrl); kfree(udev); } @@ -208,6 +212,11 @@ static int __qedi_alloc_uio_rings(struct qedi_uio_dev *udev) if (udev->ll2_ring || udev->ll2_buf) return rc; + /* Memory for control area. */ + udev->uctrl = (void *)get_zeroed_page(GFP_KERNEL); + if (!udev->uctrl) + return -ENOMEM; + /* Allocating memory for LL2 ring */ udev->ll2_ring_size = QEDI_PAGE_SIZE; udev->ll2_ring = (void *)get_zeroed_page(GFP_KERNEL | __GFP_COMP); @@ -237,7 +246,6 @@ static int __qedi_alloc_uio_rings(struct qedi_uio_dev *udev) static int qedi_alloc_uio_rings(struct qedi_ctx *qedi) { struct qedi_uio_dev *udev = NULL; - struct qedi_uio_ctrl *uctrl = NULL; int rc = 0; list_for_each_entry(udev, &qedi_udev_list, list) { @@ -258,21 +266,14 @@ static int qedi_alloc_uio_rings(struct qedi_ctx *qedi) goto err_udev; } - uctrl = kzalloc(sizeof(*uctrl), GFP_KERNEL); - if (!uctrl) { - rc = -ENOMEM; - goto err_uctrl; - } - udev->uio_dev = -1; udev->qedi = qedi; udev->pdev = qedi->pdev; - udev->uctrl = uctrl; rc = __qedi_alloc_uio_rings(udev); if (rc) - goto err_uio_rings; + goto err_uctrl; list_add(&udev->list, &qedi_udev_list); @@ -283,8 +284,6 @@ static int qedi_alloc_uio_rings(struct qedi_ctx *qedi) udev->rx_pkt = udev->ll2_buf + LL2_SINGLE_BUF_SIZE; return 0; - err_uio_rings: - kfree(uctrl); err_uctrl: kfree(udev); err_udev: