From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751504AbdJWLNg (ORCPT ); Mon, 23 Oct 2017 07:13:36 -0400 Received: from mga02.intel.com ([134.134.136.20]:61363 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751297AbdJWLNf (ORCPT ); Mon, 23 Oct 2017 07:13:35 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,422,1503385200"; d="scan'208";a="1208921278" Date: Mon, 23 Oct 2017 14:04:45 +0300 From: Mika Westerberg To: Bjorn Helgaas Cc: Bjorn Helgaas , Ashok Raj , Keith Busch , "Rafael J . Wysocki" , Lukas Wunner , Michael Jamet , Yehezkel Bernat , Mario.Limonciello@dell.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 8/8] PCI: pciehp: Check that the device is really present before touching it Message-ID: <20171023110445.GA29656@lahna.fi.intel.com> References: <20171013183548.68283-1-mika.westerberg@linux.intel.com> <20171013183548.68283-9-mika.westerberg@linux.intel.com> <20171020211502.GR6332@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171020211502.GR6332@bhelgaas-glaptop.roam.corp.google.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 04:15:02PM -0500, Bjorn Helgaas wrote: > > + > > + /* Check if the device is really there anymore */ > > + present = presence ? pci_device_is_present(dev) : false; > > + > > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && present) { > > pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); > > I don't like this fix because it's still racy. We always have to be deal > with a config read that returns 0xffffffff, even if we previously checked > pci_device_is_present(). The device might have disappeared in the interim. That's a fair point. I guess it is better just to check if bctl holds 0xffff before we decide it is a display device. I'll rework this patch and send an updated version separately.