Received: by 10.223.164.202 with SMTP id h10csp414455wrb; Wed, 22 Nov 2017 23:57:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMaaD7mIvdpb40yPqzVEuW9cQYF4zU9JH2sGmJxWN12rDV9RUfMVA08pgBlZRAZopg08y92E X-Received: by 10.98.7.149 with SMTP id 21mr22103877pfh.14.1511423827551; Wed, 22 Nov 2017 23:57:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511423827; cv=none; d=google.com; s=arc-20160816; b=txBElIs61IuuARvWpMNthaxYZSU0jgEEnUHirVDr6Hw9+69rAp4ay0aC/uS6o4x9GT +YI9lzldaG5PWIsvn7jN7MVnDHpSvi8L3VEgkidFJ4jCasKvqjSXo5beoggcNzN4A44w DUs7S1DuFHPXwbYVWZYEW4vOjjz+AbHIUqpkah81xUIQuXe3pN34AJ7cEGaWDXTGCQ9K m3ag4dHbaTsHgYO7iL872i3L/EqhR7FFgj9o0qJH7+Vj4RoN0DMP6i2SAmOHigHHP8p7 ugWuEpKRSNVlRPLGP7DwhCC3mty+G6VdWU0XupDIBaSJKelB+kpTzg9mZYZSl2eIXUOa lXEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=l+HBYzOQIfrMtxpxTQPF/eeoK6wnGDld8acuc14dcX0=; b=TXtFfwibouJ//Gz4G33skyQrLXGZf8lGqrvSrG6XS7AcB4tMQPoaq+y2pf1avTG8cb Mk5/EvV2/LncI53yvXRgmo7JXcAAxeNRA4/+BpwrDB8hsO3vQtUp0d2qRpbtNb3xZw0D 9qAYFKILURjO58UUcGn4OmnudQEfEh0JmwkFn9wXXal5svmrz7gpYasnFAXcdIxVmwov DJKxtI1uYlF49dfsiJYvULTnqx/owu9tCMheJZhbstooFFoIke/aMBLezaK/L7HA46Vd ER1L8rRlYzTwauO5Q+xDakLuOvzPThL7F1Dc1Qm+pogxx7N1AH36712SuCvuEmi039yC w03Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4si3331086pgj.545.2017.11.22.23.56.55; Wed, 22 Nov 2017 23:57:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751984AbdKWH4V (ORCPT + 77 others); Thu, 23 Nov 2017 02:56:21 -0500 Received: from bastet.se.axis.com ([195.60.68.11]:43541 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751621AbdKWH4U (ORCPT ); Thu, 23 Nov 2017 02:56:20 -0500 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id 0F906185FB; Thu, 23 Nov 2017 08:56:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id CqxmY6HWUbsA; Thu, 23 Nov 2017 08:56:18 +0100 (CET) Received: from boulder02.se.axis.com (boulder02.se.axis.com [10.0.8.16]) by bastet.se.axis.com (Postfix) with ESMTPS id D5D35185FA; Thu, 23 Nov 2017 08:56:17 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C08371A063; Thu, 23 Nov 2017 08:56:17 +0100 (CET) Received: from boulder02.se.axis.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B516A1A060; Thu, 23 Nov 2017 08:56:17 +0100 (CET) Received: from thoth.se.axis.com (unknown [10.0.2.173]) by boulder02.se.axis.com (Postfix) with ESMTP; Thu, 23 Nov 2017 08:56:17 +0100 (CET) Received: from lnxjespern3.se.axis.com (lnxjespern3.se.axis.com [10.88.4.8]) by thoth.se.axis.com (Postfix) with ESMTP id A80711D01; Thu, 23 Nov 2017 08:56:17 +0100 (CET) Received: by lnxjespern3.se.axis.com (Postfix, from userid 363) id A3D90800EF; Thu, 23 Nov 2017 08:56:17 +0100 (CET) Date: Thu, 23 Nov 2017 08:56:17 +0100 From: Jesper Nilsson To: Nicolas Pitre Cc: Jesper Nilsson , Guenter Roeck , Tejun Heo , Christoph Lameter , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mikael Starvik , linux-cris-kernel@axis.com Subject: Re: mm/percpu.c: use smarter memory allocation for struct pcpu_alloc_info (crisv32 hang) Message-ID: <20171123075617.GE20542@axis.com> References: <62a3b680-6dde-d308-3da8-9c9a2789b114@roeck-us.net> <20171120185138.GB23789@roeck-us.net> <20171120211114.GA25984@roeck-us.net> <20171121014818.GA360@roeck-us.net> <20171122153453.GB20542@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-GCONF: 00 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 22, 2017 at 03:17:00PM -0500, Nicolas Pitre wrote: > On Wed, 22 Nov 2017, Jesper Nilsson wrote: > > > On Mon, Nov 20, 2017 at 10:50:46PM -0500, Nicolas Pitre wrote: > > > On Mon, 20 Nov 2017, Guenter Roeck wrote: > > > > On Mon, Nov 20, 2017 at 07:28:21PM -0500, Nicolas Pitre wrote: > > > > > On Mon, 20 Nov 2017, Guenter Roeck wrote: > > > > > > > > > > > bdata->node_min_pfn=60000 PFN_PHYS(bdata->node_min_pfn)=c0000000 start_off=536000 region=c0536000 > > > > > > > > > > If PFN_PHYS(bdata->node_min_pfn)=c0000000 and > > > > > region=c0536000 that means phys_to_virt() is a no-op. > > > > > > > > > No, it is |= 0x80000000 > > > > > > Then the bootmem registration looks very fishy. If you have: > > > > > > > I think the problem is the 0x60000 in bdata->node_min_pfn. It is shifted > > > > left by PFN_PHYS, making it 0xc0000000, which in my understanding is > > > > a virtual address. > > > > > > Exact. > > > > > > #define __pa(x) ((unsigned long)(x) & 0x7fffffff) > > > #define __va(x) ((void *)((unsigned long)(x) | 0x80000000)) > > > > > > With that, the only possible physical address range you may have is > > > 0x40000000 - 0x7fffffff, and it better start at 0x40000000. If that's > > > not where your RAM is then something is wrong. > > > > > > This is in fact a very bad idea to define __va() and __pa() using > > > bitwise operations as this hides mistakes like defining physical RAM > > > address at 0xc0000000. Instead, it should look like: > > > > > > #define __pa(x) ((unsigned long)(x) - 0x80000000) > > > #define __va(x) ((void *)((unsigned long)(x) + 0x80000000)) > > > > > > This way, bad physical RAM address definitions will be caught > > > immediately. > > > > > > > That doesn't seem to be easy to fix. It seems there is a mixup of physical > > > > and virtual addresses in the architecture. > > > > > > Well... I don't think there is much else to say other than this needs > > > fixing. > > > > The memory map for the ETRAX FS has the SDRAM mapped at both 0x40000000-0x7fffffff > > and 0xc0000000-0xffffffff, and the difference is cached and non-cached. > > That is actively (ab)used in the port, unfortunately, allthough I'm > > uncertain if this is the problem in this case. > > It certainly is a problem. If your cached RAM is physically mapped at > 0xc0000000 and you want it to be virtually mapped at 0xc0000000 then you > should have: > > #define __pa(x) ((unsigned long)(x)) > #define __va(x) ((void *)(x)) > > i.e. no translation. Sorry, it's the other way around, cached memory is at 0x40000000 and non-cached is at 0xc0000000, so the translation is right, even if as you pointed out earlier, it should be performed differently. > For non-cached RAM access, there are specific > interfaces for that. For example, you could have dma_alloc_coherent() > take advantage of the fact that memory with the top bit cleared becomes > uncached. But __pa() is the wrong interface for obtaining uncached > memory. > > Nicolas /^JN - Jesper Nilsson -- Jesper Nilsson -- jesper.nilsson@axis.com From 1584798759737975401@xxx Wed Nov 22 20:17:53 +0000 2017 X-GM-THRID: 1584466607656225114 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread