From owner-freebsd-hackers@freebsd.org Sat Sep 8 16:16:45 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B4CEFF75A6 for ; Sat, 8 Sep 2018 16:16:45 +0000 (UTC) (envelope-from yuripv@yuripv.net) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BD8D7067A for ; Sat, 8 Sep 2018 16:16:45 +0000 (UTC) (envelope-from yuripv@yuripv.net) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 67F5821A7B for ; Sat, 8 Sep 2018 12:16:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sat, 08 Sep 2018 12:16:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuripv.net; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=bHq1/9ZTLy7r5VRedtJF7LJUdvjLlSsVH7arTEOgLZI=; b=s0jW1Zt6 IWzOwX4HB7pRK4vWDscRlA3SXpFF25sY8jghvS7OmqcaqZwl9WTGB56e4bWoO7fC BXDeDVasCzneXrIHx+m3FxKo2Lhv+6rKXtE4dldGRABP5DH3XVRIuxtwn6Bq6Fh+ vMBUDCvkLIDOkhYgR5+gfS2AMjTW7QHtgRUxj/2rqtzzonru5mYjjfpYyqQJBq9E xi5saFw76vUgedLW+zWA6xaM/iLNeojIelKgfZgoCmqYRjow7ZC/nvV+Nr2QbhEb pcSh18ucvBZDPnh+4et8c6WLmvr6s8I6OxFbeM2Pukq3I2a1ehaSI+dBgk1eM2R7 eH+uDTTOpwhvCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=bHq1/9ZTLy7r5VRedtJF7LJUdvjLl SsVH7arTEOgLZI=; b=aZqMEx1anByAI09gByUwvKFRn8p53QTzo7efJMC7EUqZx ddsezWFjfiWaZESDn+QFP1drHWxRIzEUYmc0Mhb7wd5hRMbuz0apW2Y0ox4Ou5oU 03doAbDLpAoT0Je0T6PuT0FnOWUCym063Ye7GyY1yT0Kx8h9RnbbqLrWDE/2XV5L BfdcfSVnWNYaxDz+Q/hBcNnv5axy1eL2lkBkXLbwtwWKDRtpjEbD4wQkT0qLa4Kd HlIZ6N2M+LQb/76tiKEwGNdsYWynvSLI6nk1TcrRZjfDBFkYChm7pH8NOtuj/gOr cJCYUK2pboQqyai0WQuzRctqFdrkVdtyuajYliMbA== X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.2] (unknown [62.183.126.215]) by mail.messagingengine.com (Postfix) with ESMTPA id 1824D10294 for ; Sat, 8 Sep 2018 12:16:36 -0400 (EDT) To: freebsd-hackers From: Yuri Pankov Subject: intelspi: don't leak spibus children on detach Message-ID: <2fc2bf25-e619-26e6-559b-6235ba9d4fe4@yuripv.net> Date: Sat, 8 Sep 2018 19:16:32 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Sep 2018 16:16:45 -0000 This one is a bit more involved than typo fixes, so I have opened a review: https://reviews.freebsd.org/D17076 The point is storing the device_t for spibus we add on intelspi attach and deleting it on intelspi detach. Currently it looks like below, without the patch we don't delete spibus children and loading intelspi would create new spibus numbers, which is wrong. # kldload intelspi spi0: <100 Series/C230 Series Chipset Family Serial IO GSPI #0> mem 0x8272d000-0x8272dfff,0x80000000-0x8000007f irq 22 at device 30.2 on pci0 spibus0: on spi0 spi1: <100 Series/C230 Series Chipset Family Serial IO GSPI #1> mem 0x8272e000-0x8272efff,0x80000080-0x800000ff irq 23 at device 30.3 on pci0 spibus1: on spi1 spigen0: at cs 0 mode 0 on spibus1 # kldunload intelspi spibus0: detached spi0: detached spigen0: detached spibus1: detached spi1: detached P.S. if there's a better way of submitting patches (PRs, lists, anything), please let me know, I have quite a few of them already looking at the mbp spi devices.