[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC] xen/pci: detect when BARs overlap RAM


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 27 Jan 2022 09:27:08 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FokOvpbtqEKuo3CLY63io3uWo3Idy8l8lS9fNisrU0A=; b=cSZR2p4tPtKcrYg7AaKFmXFh07a2hd3qDofnybbL7W8TGIVWtzVE8ayNJeqY2rSXZsWZ6Mr7BmNhK2kAxI3ZAIzYT1QyJNhy2p7AUDw0YxcLhoO4vw9fP9tZSNElF7Wqbx8xt/6thPacfPM/q6SmwdZtYhadCSHqhdkYgxYkuVYYnhtuKy8+2oYklKAeK3rptAOCgLq/9qxUc4kQ99yo8gualht+Ke2rLw/c3LR2i52GONW0vWbTa/LFdjmWDnB8E6x0NJfntKjUhmIbTJH3cLOS/6KOmw2asnS4WnNBjgGystuM8kjuvRnFx5NjM9MAhqC18ePd7+9XIoiWwlU72A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ERcL5QE/G+340MEaLL5mLVpRP0zpc9ikW76FC/n4XIc/XMIA4+X9zUsOGkdgvilkjcsHhdtvXrK70tqsnd8cIEDfPi9bekbTxkKj174KVOWqNegVWW75ukWOL/b0eAW+c4YRafMe6jPagpz3NIZH0zuCsL9hWtTA6OkcRO0xvDRCGUQS64L7IW+ul6znRn7KNp5TSISGu3Q9BguI+m8Qdw1dL092rx0CHOw45RoCWlrkBhVAXIIzA3SeY9MYoH9zt94a7WchfHTioDxAJJrgR9Ml8rOWkH6N/CiynueAeES/1/YPTYWROuQBMZm5u6kRke+vQ46pR0gFbCiFF8NxZQ==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Wei Liu" <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 27 Jan 2022 08:27:23 +0000
  • Ironport-data: A9a23:ayFZzqACcAl7oRVW/2Plw5YqxClBgxIJ4kV8jS/XYbTApGxwhTNRz WtOWmCCaK6CMTH2fd5+PN7j8RwGvZDdn4IwQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WL6s1hxZH1c+En940007wobVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/tymlgZcgx ctxqIXhcl5yL4Pdl9QkTEwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTUO5ji95lNMD2FIgepmth3XfSCvNOrZXrHf+VtIcCh2pYasZmEcfMd ssrODVWQC/fUwFmMFI8D8ogtbL97pX4W2IB8w/EzUYt2EDMyCRh3b6rN8DaEvSASN9JhE+eq iTD9n7gHxABHNWFzHyO9XfErv/Cm2b3VZwfEJW89+V2mxuDy2oLEhoUWFCn5/6j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X3QFK9WVlRwtY+RxLzuZvN zU5LEZyP6iPo29licUrs7pAwO2d6Ml1InDM9mY=
  • Ironport-hdrordr: A9a23:61QHFKPB7MMwI8BcTsWjsMiBIKoaSvp037BN7TEXdfU1SL39qy nKpp8mPHDP5Ar5NEtOpTniAsm9qBHnm6KdiLN5Vd3OYOCMggqVBbAnwYz+wyDxXw3Sn9QtsJ uIqpIOa+EY22IK7/rH3A==
  • Ironport-sdr: sJ64WfSDeMdiONTXucYd3uTx5dZ2R0smuh8B25H2gPfgwnJOOsUaKVlIUdnwhhJKX3d3GFbFjd L58Z6EmBnPo3hi9ZEODD+dzp9LwpHkci5Orp7kpZ3QUJtry0iUpyqwaVU6APCvwm1qN+fpj/wz jCsiD2XyJu25SFtVOMXYQyO4Jru6xQmLWE9lFW/vCooIx1KnWNU/Vp7YXT3BysTO8Y91eKiuxK ts+9NUP4jZDZgrYClQ7tTDVIjCWXA445xg554DzwT7bWFPZuGOIh4NRpbLglvihgNWmwROcafL nd/0Qu5MURQbp0rQBQEQ0nLp
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Jan 26, 2022 at 05:09:56PM +0100, Jan Beulich wrote:
> On 26.01.2022 16:45, Roger Pau Monné wrote:
> > On Wed, Jan 26, 2022 at 03:08:28PM +0100, Jan Beulich wrote:
> >> On 26.01.2022 13:26, Roger Pau Monne wrote:
> >>> +        if ( entry->type != E820_RAM && entry->type != E820_ACPI &&
> >>> +             entry->type != E820_NVS )
> >>> +            continue;
> >>
> >> I think UNUSABLE also needs checking for here. Even further, it might
> >> be best to reject any range overlapping an E820 entry, since colliding
> >> with a RESERVED one could mean an overlap with e.g. MMCFG space.
> > 
> > Hm, I've though about adding UNUSABLE and RESERVED (and should have
> > added a note about this), but that might be too restrictive.
> 
> Why (other than because of firmware bugs)?

Handling overlaps with those wasn't strictly needed to solve the issue
at hand, but I didn't take into account that an overlap with a MMCFG
region would be equally bad. I've extended the check to cover any
E820 entry.

> >>> +        if ( size && !is_iomem_range(addr, size) )
> >>> +        {
> >>> +            /*
> >>> +             * Return without enabling memory decoding if BAR overlaps 
> >>> with
> >>> +             * RAM region.
> >>> +             */
> >>> +            printk(XENLOG_WARNING
> >>> +                   "%pp: disabled: BAR%u [%" PRIx64 ", %" PRIx64
> >>> +                   ") overlaps with RAM\n",
> >>
> >> Mentioning "RAM" in comment and log message is potentially misleading
> >> when considering what other types get also checked (irrespective of my
> >> earlier comment). (Ftaod I don't mind the title using "RAM".)
> > 
> > Would the message below be better?
> > 
> > "%pp disabled: BAR%u [%" PRIx64 ", %" PRIx64 ") overlap detected\n"
> 
> This or maybe
> 
> "%pp disabled: BAR%u [%" PRIx64 ", %" PRIx64 ") overlaps with memory map\n"
> 
> in particular if, on x86, we'd be checking for any E820 entry type.

Done.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.