From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 265FCCF34A1 for ; Thu, 3 Oct 2024 11:51:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 423DA6B041B; Thu, 3 Oct 2024 07:51:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D4086B041C; Thu, 3 Oct 2024 07:51:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 275074401B5; Thu, 3 Oct 2024 07:51:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 009446B041B for ; Thu, 3 Oct 2024 07:51:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7B78B1A147E for ; Thu, 3 Oct 2024 11:51:37 +0000 (UTC) X-FDA: 82632126234.08.8CE4CC0 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf29.hostedemail.com (Postfix) with ESMTP id 7D99712001A for ; Thu, 3 Oct 2024 11:51:35 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BcySxTgq; spf=pass (imf29.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727956167; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IX9tvTHLAOYgmvxpBneEKBUS+/RTMNfK5EVxf2TOLuM=; b=1DsO2HwHchU8o0DDzOf9vcnxoM8IipiRUPfOBEGbF0CaFP3ZfU0JPQLQNsUvelvjyJ6Qhk vWJ8nt2U7NUTb2+V2l+JRIy/N9YdVgLzaENos5dVtaF8lssvS6bgAS2af/fvbpzO+onrA3 EufLklUw/4OfMYVem6zdtMGRGmQtK9c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727956167; a=rsa-sha256; cv=none; b=Q/kEC6+GU2MLozZkZ7S1VAQRFSLgCqEGtAumW26TnvczTWeYy9p6zTBBRgn2SeSIN8bDeT KZ2re892D/yDy9omQix0V0EHnJU0/vJED3Ge0zmQzmuBwxfu1J4WUsBzPv9mvMucTdTQES Dh7M1MwOaXvt6VFlgTFIXFgngYTrnsc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BcySxTgq; spf=pass (imf29.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a8d43657255so140143466b.0 for ; Thu, 03 Oct 2024 04:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727956294; x=1728561094; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IX9tvTHLAOYgmvxpBneEKBUS+/RTMNfK5EVxf2TOLuM=; b=BcySxTgqJKsHrrqocQheuUJvULcjfCVFWYxjJlpmYCueffMTByz6GvsR1V8iA/pVTm 5i43WClAJ/mnMfboAMhdg1522L535sQZwJHp82Pnnhht1fLEj0S8U6tshRL//Yeb82uH m1lvnCHiCEQRd1qhsDeUkMMB3BAJRoNMCTk8J49/xAlk1GeyI2l4jRt+mvU68C7O4DeM jzb+qDaj40of/nqKYKWprqW18koZTAyecK0UAQw00OwH6WiSPAnc2+9DSY5T24f4NbMn Vj3VN0gYdaAKboDa7Y78U8nsrkx4KG+qXzjSF492NLOX7SHaVJ8XmyCCOZ8XVxcVCB29 TuSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727956294; x=1728561094; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IX9tvTHLAOYgmvxpBneEKBUS+/RTMNfK5EVxf2TOLuM=; b=HthOf946/et11aalA6U+UuEEy1gzGuYwPzkkV7HoxNo0SKRyzgGhbo+fLab3GtJqrs tocX6nZmrvahrCLkbgsWwwiu5v+/njLXzeCUUgqYcjsFDMN+OQpQakfj1pdDDDt1m0H5 OPolBqAw2kBlAd5I9t0dxr4KInwbNNZgoIIYnHfK6ZYsjzeVIj9CgDAgYDK1Qb57ribv WZ74Jv5AV6OeWS8PQR6z2xXo1SfTJi/6oQ1bMFc6Y5dCKFeIsdF2hGqFCuCdXpXDGQHf 828pVXg1y7l8DSbcEy6B6n2Uw5I/2WtWAfSpo/l4ZYXgX3gb/n+O/Aq4d4NV52tsl3W+ Ipyw== X-Forwarded-Encrypted: i=1; AJvYcCXJrfdtXUVOFVkfqiVp5aktHymFUGOCMuKAYdM5MLqQOaTqBDrcHeTFF3FCwiBdR4gHal7kImJSTA==@kvack.org X-Gm-Message-State: AOJu0YzE3Y7m5JoFfCn1/XAmNLjYChSdO2gudzSEaRr4WJXuiRQxsVKq lrD05SzY+XvdQT1x7dKg8JX2fhDgO+AUNatoaztFXx+gPUnc68V9 X-Google-Smtp-Source: AGHT+IGjsHGnUfYGC96kOqpUuLWRj65nI1QtiDjAvHGAxnWeJTR4Pja1kibf9jVolcOP0OF/G7jHAA== X-Received: by 2002:a17:907:9706:b0:a8a:8cdb:83a7 with SMTP id a640c23a62f3a-a98f838a302mr571025166b.54.1727956293522; Thu, 03 Oct 2024 04:51:33 -0700 (PDT) Received: from [192.168.1.50] ([147.12.138.70]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a99103b314asm75313266b.103.2024.10.03.04.51.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Oct 2024 04:51:33 -0700 (PDT) Message-ID: <1ea5538f-7e96-4034-9af9-e2d5fd72e069@gmail.com> Date: Thu, 3 Oct 2024 12:51:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: arm64: Kexec: Warning: virt_to_phys used for non-linear address To: Will Deacon , Breno Leitao , Mark Rutland Cc: Rob Herring , kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, catalin.marinas@arm.com, rmikey@meta.com References: <20240624113614.GA8361@willie-the-truck> <20240823133842.GE32156@willie-the-truck> Content-Language: en-US From: Usama Arif In-Reply-To: <20240823133842.GE32156@willie-the-truck> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 7D99712001A X-Stat-Signature: coq39stan3z9z1cyr84msk84kyrtek1w X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1727956295-149573 X-HE-Meta: U2FsdGVkX1+WHESFp0OyftrI4bINf46h51Il9y3aHykC0ddHfeKk+eLi5Hq8WQ03/IxEke4ZzSggvKRA0uL74dHOQvNgKWAjRDOUoCJwt7xytvS16niO6I7pDUB1UYw06AIUz8C2y/6eEsUhjvOYlfoLwRxnBWy1stbkX7TcZ4Gqey1pXDCqsNC0VrI/pbIP8ZaPZjp1f053ISRZZgywHnWRoEMNYMKlJQeAGsZdF9BglpUbb2vz1U49WCrl9X4J6wI689HceSb7V++z1J8UI7PVVEE1yTHXcMly4H6TntblO8wElw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Zl0reKwxzwQRrm2HITP96MzTy5/hm6ivZbztHb9jwFNbvWV07dmnKaCaRP4AeXjz3Y4Fh3Sb0OHhyEWAWbVmUU6Sx74NtYCvTKjHflJN7clAtFGP8pIs9NH0zjZ9BohVzMRq5j6aTWVpKZVyFFDFzZ9uJPHpgj/UNwv8eIfLr9RD0Wk/SSCLEonTHSv5Zq0ejfSqtaj5R4Hvskezx6ZqUKcOzsGqlRYznWW90jjXW1doFw+m X-Bogosity: Ham, tests=bogofilter, spamicity=0.000555, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 23/08/2024 14:38, Will Deacon wrote: > On Thu, Aug 22, 2024 at 02:28:03AM -0700, Breno Leitao wrote: >> On Mon, Jun 24, 2024 at 12:36:14PM +0100, Will Deacon wrote: >>> On Tue, Jun 18, 2024 at 12:36:03PM +0100, Mark Rutland wrote: >>>> On Tue, Jun 18, 2024 at 01:49:22AM -0700, Breno Leitao wrote: >> >>>>> Since __pa() is a macro to __virt_to_phys(): >>>>> >>>>> #define __pa(x) __virt_to_phys((unsigned long)(x)) >>>>> >>>>> I am curious why this address is special that makes __virt_to_phys() >>>>> unhappy. >>>> >>>> It's a fixmap address rather than a linear-map address. Confusingly >>>> 'virt' generally means the linear map rather than any virtual address, >>>> and usually virt_to_*() only work on linear map addresses. >>>> >>>> I'm not sure how to fix this; the major reason we fixmap the FDT is so >>>> that it can be anywhere in memory (and e.g. may not be in the linear map >>>> at all), so we can't always generate a linear map VA. >>>> >>>> We could stash the PA at boot time, and pass this as an argument to >>>> of_kexec_alloc_and_setup_fdt(). >>> >>> Yeah, if it was passed as an additional argument to early_init_dt_scan(), >>> then the core could could track it. Alternatively, we'd need a helper >>> macro to get the PA and have an arm64-variant for the fixmap (everybody >>> else could use __pa()). >>> >>>> Rob, any thoughts? I couldn't see a neat way of doing this, but maybe we >>>> could initialise an initial_boot_params_phys at setup time, with a bit >>>> of churn to early_init_dt_verify() and friends? >>> >>> Rob? >> >> Hello, is there anything I can do or test to have this moving? > > I've not seen anything from Rob, so the best bet is probably to see if > you can hack up a patch to fix it yourself and then cc the rest of us > when you post it. > > Will > Hi, We are seeing this while doing kexec, so I sent a potential fix in [1]. I did print the values and they are different initial_boot_params_pa 0x6937a00000 __pa(initial_boot_params) 0x8000125e0000 so I think a fix is necessary as we are deleting some random memory while doing kexec which could lead to very difficult to debug crashes if its something critical. I just stashed the physical address and used it later during kexec. I dont see anything that could convert fixmap to phys, but maybe its there and I didn't find it? The other option is to write fix_to_phys which would look something very similar to like kernel_page_present [2]? I do think the patch in [1] is much simpler, but happy to try something like [2] or anything else that is recommended. Thanks! Usama [1] https://lore.kernel.org/all/20241003113840.2972416-1-usamaarif642@gmail.com/ [2] https://elixir.bootlin.com/linux/v6.11.1/source/arch/arm64/mm/pageattr.c#L213 > _______________________________________________ > kexec mailing list > kexec@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/kexec