Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297717

Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support
Date Thu, 24 Dec 2015 02:50:02 +0100
Message-ID <qJ3ct-o7-1@gated-at.bofh.it> (permalink)
References <qrJ0u-Z9-3@gated-at.bofh.it> <qBs81-7iq-5@gated-at.bofh.it> <qBs81-7iq-15@gated-at.bofh.it> <qFKJ4-4oW-9@gated-at.bofh.it> <qFR7P-fs-1@gated-at.bofh.it> <qG88G-2Z6-3@gated-at.bofh.it> <qGK4j-21x-37@gated-at.bofh.it> <qIjCF-5Bi-17@gated-at.bofh.it> <qIDUJ-1q6-7@gated-at.bofh.it> <qIIhI-4lA-11@gated-at.bofh.it>
X-Original-To "Zheng, Lv" <lv.zheng@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=ADqIykHCPj72UbIAYXXon/NZ/5SQD2bRMP2o/p/jTU8=; b=uklM2IK7Vt77FC+NA0Yh/LXKspMSIHGx8U1u5xSvUil0CKrvB7SMwG5ysjVG2x0oyk 4klGzcCPDcTrIUMXhHifBwtC6suIuXy+a3Klh3Mics7+5h83evbXnxU9AuCUjR4CLeo3 3waCrv7mcTwMUNU7iQtgdTA0nJ6Dg46cP7osd7CDqyvJkSJJNlKcoU1HNMHRF3KVe5Ez jR4CY49NzlurPjYIfXkRQ9deF9WUQVidLYcTZBL09QXq7hd4JTGK9g7ZYjI9hq3PAWoc XarGYKwifhkasaexzvAtSl37Pm7t6KnCy2mMEyrn0+mxTayZZvV8stVm05sgRufkJsDG FsNw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=ADqIykHCPj72UbIAYXXon/NZ/5SQD2bRMP2o/p/jTU8=; b=Ki5AM77WRqZ0+huqzqXh9ZRYcj3QplMTMc0lmLOaabnDviuJG32tU9/xByS4R6vrFf CsUsonCUWktj+PnEEv4FMNqDftLWuIwHhPJ5oS9pbY8m8dOAXjCQqpTFTUmSpvmbanZu qwZ3zU14IjlgTSqQlAt624H9i7rrOt7gMM7dHYXMlnI5ja6GZw1KAw5dmEhlw9IDCuIW QL19BqhMP0VnC4i1nfcO9FQFOOQns3TUFDQOFn4PYIt6vJxfNoW+R/AFUIgU08x1YNuX 3a3cq7REuvJZYn21/shflhkxEl+NHJ/+xHbDiw1Ra1tmkiCu1d9qYXjoAt7mZlsARs8E n4aA==
X-Gm-Message-State ALoCoQlWGb/AlasMJin76065uDSBoT/o1K2wAzeIG4xHDGbwj9gqrjkwsHh07DxkeYprUkgaTUhLpsRDtMrkcv/LYv71uYcTWw==
X-Received by 10.182.171.105 with SMTP id at9mr18341145obc.49.1450921250602; Wed, 23 Dec 2015 17:40:50 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8BIT
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 82
Organization linux.* mail to news gateway
X-Original-Cc "Chen, Yu C" <yu.c.chen@intel.com>, "Moore, Robert" <robert.moore@intel.com>, "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>, "Brown, Len" <len.brown@intel.com>, Andy Lutomirski <luto@kernel.org>, Lv Zheng <zetalog@gmail.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Linux ACPI <linux-acpi@vger.kernel.org>, "H. Peter Anvin" <hpa@zytor.com>, Borislav Petkov <bp@alien8.de>
X-Original-Date Wed, 23 Dec 2015 17:40:30 -0800
X-Original-Message-ID <CALCETrWBavzmaDy5u_O09rdqiRn4K=pjDwkwd+hdGd4OWV-+6g@mail.gmail.com>
X-Original-References <cover.1446790780.git.lv.zheng@intel.com> <cover.1449108825.git.lv.zheng@intel.com> <af8b1799e7eec686fbb3bf239f6f400adb3b8082.1449108826.git.lv.zheng@intel.com> <CALCETrXeoGZhrNr9OmqFB+i7-tbM+d3sO8uCNnMx40JfDsjoEw@mail.gmail.com> <36DF59CE26D8EE47B0655C516E9CE64028686D35@shsmsx102.ccr.corp.intel.com> <1AE640813FDE7649BE1B193DEA596E883BB08C24@SHSMSX101.ccr.corp.intel.com> <CALCETrWzn_9wL_7zL4GdHrFB3c9qaAjnEbLdU+bppLf-GVsx3w@mail.gmail.com> <36DF59CE26D8EE47B0655C516E9CE640286886D1@shsmsx102.ccr.corp.intel.com> <CALCETrVcYbqNpVi4J_iQL1WPYCA1zPJAs+csx73CaQvYziDY1g@mail.gmail.com> <1AE640813FDE7649BE1B193DEA596E883BB0A29B@SHSMSX101.ccr.corp.intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1297717

Show key headers only | View raw


On Tue, Dec 22, 2015 at 7:25 PM, Zheng, Lv <lv.zheng@intel.com> wrote:
> Hi, Andy
>
>> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-
>> owner@vger.kernel.org] On Behalf Of Andy Lutomirski
>> Sent: Wednesday, December 23, 2015 6:49 AM
>> Subject: Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support
>>
>> On Mon, Dec 21, 2015 at 5:03 PM, Chen, Yu C <yu.c.chen@intel.com> wrote:
>> > Hi Andy,
>> > thanks for your review,
>> >
>> >> -----Original Message-----
>> >> From: Andy Lutomirski [mailto:luto@amacapital.net]
>> >> Sent: Friday, December 18, 2015 1:00 AM
>> >> To: Zheng, Lv
>> >> Cc: Chen, Yu C; Moore, Robert; Wysocki, Rafael J; Brown, Len; Andy
>> >> Lutomirski; Lv Zheng; linux-kernel@vger.kernel.org; Linux ACPI; H. Peter
>> >> Anvin; Borislav Petkov
>> >> Subject: Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable()
>> support
>> >>
>> > [cut]
>> >>
>> >> I think that hpa or Borislav [cc'd] could address the memory map details
>> >> better than I could.  However, this functionality seems strange.
>> >>
>> >> Are these physical addresses or virtual addresses that are being dumped?
>> > [Yu] They are  virtual addresses to be dumped.
>> >> In  either case, ISTM that using something iike page_is_ram might be a lot
>> >> simpler.
>> > [Yu] if i understand correctly, this API is used to check if the address is a valid
>> > 'kmalloc' style address, but not 'kmap' or 'vmalloc' address, and page_is_ram
>> > might treat the latter as valid address?
>> >
>>
>> I'm a bit puzzled as to why this matters, but I have no fundamental objection to doing it that way.
> [Lv Zheng]
> IMO, using page_is_ram() or something similar, the problem is what we need to solve in the current approach still need to be solved:
> 1. How can we convert a virtual address into a "struct page"?
>     There is no kernel API to convert any virtual address into struct page.
>     Even there is such a kernel API to convert kmap/vmalloc addresses, we still couldn't use it.
>     Because if we want to validate kmap/vmaloc pages, we need 2 APIs rather than 1 API while ACPICA only provides 1 API for this purpose.
>     The 2 APIs should be get/put style to ping the page mappings as the mappings other than the direct mappings will not be stationary in the kernel address space.
>     Fortunately we needn't take care of the mappings other than the direct mappings (reasons are in the 2nd comment).
>     So we still need to use the direct mapping APIs here.
> 2. How can we ensure the page is a direct mapping page?
>     I think Yu should confirm if there is such a common kernel API.
>     If there is such an API, we should use it so that we can remove the arch specific stuffs.
>
>> What's the use case, though?
> [Lv Zheng]
> Fortunately, currently ACPICA only uses this API to validate if a namespace node, an operand object or a parser object is readable.
> See drivers/acpi/acpica/dbdisplay.c and drivers/acpi/acpica/dbcmds.c.
>
>>  That is, what goes wrong if the function just always returns false?
> [Lv Zheng]
> 1. If it always returns false, then many ACPICA debugger internal object conversion/dump functionalities won't be functioning.
>     For example, you can try to type “dump \_SB" in acpidbg shell and it will return an error:
>       "Invalid named object at address xxxxxxxxxxxxxxxx"
> 2. While if this function always returns true (current linux-pm/linux-next merged stuffs), we can see such a result:
>       Object (ffffxxxxxxxxxxxx) Pathname: \_SB
>           Name : _SB_
>           Type : 06 [Device]
>

It seems a bit unfortunate to me that the ACPICA debugger lets
userspace choose what address to dump rather than dumping by pathname,
but given that constraint, I guess this function is needed.

Can you do something like checking virt_addr_valid and then using
virt_to_pfn and page_is_ram?  If that's not enough (e.g. if it doesn't
work for vmalloc addresses and you need those), you could try to do
something like slow_virt_to_phys, but you'd need to do some extra
checks to avoid the BUG in the function.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support Andy Lutomirski <luto@amacapital.net> - 2015-12-15 00:30 +0100
  RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Chen, Yu C" <yu.c.chen@intel.com> - 2015-12-15 07:20 +0100
    RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Zheng, Lv" <lv.zheng@intel.com> - 2015-12-15 10:00 +0100
    RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Zheng, Lv" <lv.zheng@intel.com> - 2015-12-16 01:30 +0100
      Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support Andy Lutomirski <luto@amacapital.net> - 2015-12-17 18:00 +0100
        RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Chen, Yu C" <yu.c.chen@intel.com> - 2015-12-22 02:10 +0100
          Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support Andy Lutomirski <luto@amacapital.net> - 2015-12-22 23:50 +0100
            RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Zheng, Lv" <lv.zheng@intel.com> - 2015-12-23 04:30 +0100
              Re: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support Andy Lutomirski <luto@amacapital.net> - 2015-12-24 02:50 +0100
                RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Chen, Yu C" <yu.c.chen@intel.com> - 2015-12-24 09:00 +0100
                RE: [PATCH v4 7/7] ACPI / x86: introduce acpi_os_readable() support "Chen, Yu C" <yu.c.chen@intel.com> - 2015-12-24 09:10 +0100

csiph-web