Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp441020ybm; Thu, 28 May 2020 06:47:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSM+CBMOkLBAzz6YuhxRPZN4E6kYlpQwAiAgZdhNJsUJlG7extfFKTDx7lrv6cvu0DG43w X-Received: by 2002:a17:906:f747:: with SMTP id jp7mr3072594ejb.110.1590673665786; Thu, 28 May 2020 06:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590673665; cv=none; d=google.com; s=arc-20160816; b=W09TksDb4vzYciy+5NnXtom1EaIaFA8Qm+/6rtbBj/4M6yDvYkfonBDuMgB3DPFh38 jLgBvYbsJ+rfiB60a9Ic5OWI5Op4ZO38ZB8JRKgx4nyJ5/nMgfDcMUoGH6sJ5Pxe0YpJ Vqc5VNqniEJEIl/FvAewH1QcuaFLsqggN260Dj46H63LTbKMTVft+UNep2hG9n7NqsDV ZPbDjvajzxVf4UKdAk9dYfx7XifzUdpO+CIpIVrRtrl0LQI8VLBr5eFcrb1ZBFRWyPju RMQ9FPeH59PmE/dFpJ7Ve35jbJbBQvhmmxJZqpxXd/oop5gIKgiDYoAqr4O0W0I5H7US 8GJw== 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:ironport-sdr:ironport-sdr; bh=jjE9wBB8+kChMDu2nQJ8BdIdBLt4RfwrXx5Hsw7Q/lI=; b=Ure4cyB/YVXtXG2arI9jXBXFzP5I+PGHUv0ajUSi9SqHOrgAKpdOrQCfQuIm8vkkLQ B5jVFOaJnqPeyH/rrv9I8AJLsgKm9Oon9gCUuqGZZ3onGTOkoUoJcS9oG6FhxdEo4Ehn yyK4PElkW1zJf4HXagw/ghO+pW0Y4x6XNFjygmkWB0Yf3GP5rORChPRHaegMLrQgawZU C9M2a7v52wMJJfYL6qzs33Yr3s+PJtLzrUVlhXYAOURZo8I8OJUV++jKj3/IgtNnqzEj nlSoiyVXy5tFaQoA+P5rIebdN3/I8HyvUEB2BzZovju768BxxE2HhPNEsoySKOVkHisK d1NQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si3533933edx.388.2020.05.28.06.47.20; Thu, 28 May 2020 06:47:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390541AbgE1Not (ORCPT + 99 others); Thu, 28 May 2020 09:44:49 -0400 Received: from mga04.intel.com ([192.55.52.120]:23300 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390432AbgE1Nos (ORCPT ); Thu, 28 May 2020 09:44:48 -0400 IronPort-SDR: 0rc7A3b/AGr90hv+E0/BwUlWVPjF1LxLhH66PSd2drGXgBF+3UqR1ZJtLBTTL8m1CP+rOxMHA7 uuye5ZXuXk5w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2020 06:44:47 -0700 IronPort-SDR: Mzt4PaJjqkTNatS7MO5azev6oMN7bte9xkue5TCtMR+M2a5PpSK5zjN+phy26Lk3QYqqV3NX5J VIZIjN7gDDXg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,444,1583222400"; d="scan'208";a="414602549" Received: from linux.intel.com ([10.54.29.200]) by orsmga004.jf.intel.com with ESMTP; 28 May 2020 06:44:47 -0700 Received: from [10.251.9.11] (kliang2-mobl.ccr.corp.intel.com [10.251.9.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 09215580100; Thu, 28 May 2020 06:44:46 -0700 (PDT) Subject: Re: [PATCH V2 2/3] perf/x86/intel/uncore: Record the size of mapped area To: Andi Kleen Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, David.Laight@aculab.com References: <1590671727-99311-1-git-send-email-kan.liang@linux.intel.com> <1590671727-99311-2-git-send-email-kan.liang@linux.intel.com> <20200528132908.GG611145@tassilo.jf.intel.com> From: "Liang, Kan" Message-ID: <7d593433-0e7d-afb5-0bf3-4ea6cd5ad352@linux.intel.com> Date: Thu, 28 May 2020 09:44:45 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200528132908.GG611145@tassilo.jf.intel.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 On 5/28/2020 9:29 AM, Andi Kleen wrote: > On Thu, May 28, 2020 at 06:15:26AM -0700, kan.liang@linux.intel.com wrote: >> - box->io_addr = ioremap(addr, SNB_UNCORE_PCI_IMC_MAP_SIZE); >> + if (!type->mmio_map_size) { >> + pr_warn("perf uncore: Cannot ioremap for %s. Size of map area is 0.\n", >> + type->name); >> + return; >> + } > > Is that likely that the size is 0? In case someone forgets to set mmio_map_size. > > In any case you have to test the return value of ioremap. So I would rather > test the address for 0 than the size. The box->io_addr is checked now, but there is no warning message. I will remove the check for mmio_map_size, and add a warning message for the check of box->io_addr. Thanks, Kan