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

Re: [PATCH v5 02/15] IOMMU/x86: perform PV Dom0 mappings in batches


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 1 Jun 2022 11:08:35 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; 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=UmJL8rCX2dWF7cn9lm8Lab5GIBv+/1c3huTGt1gpfug=; b=Px2itKSYw9PybJ9/bPpKCrGbwrtD3RenVtM+e7Cyy7wQvn/6gqP2y792ocgR/4yY2jN7kwFfpkUc2qHu8DqxdFcRIDtpT3siPuxWyYMr4gBRRZFv57ESKlLq+q51K08p6f78SkZKuAN6kuwjnw+9NOtFPNGs6ndRmJFagcPFjLAciR4fvGT0sKBFrqTVApBqiwQiyAqfmp8Iq3QpUDygY51OufpBxBYv6tlFMM8dVG1LsVBAfTJ1Kurhi0CzyRT4QFKmv+Cw+hwSLVsB1PiNOxRSwzYdxK7+Olvoc31JQ0f6kx49vpilfFh+PQ4CL0zsWpdtPCrxxCqv0YYzOPCoYg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLUYb6r/+sBXxSBiy0NeiQyRC8VVGYPSREdVY4+l0FdULuPNJSVCeshRwWyVkIqeDn2ycgl8iNaOo99a7i4KrZhJcV/nPLmlSKep486UClA0aDmYQTaEozuZwlpECdR8ZnURxfc65MrdxpFvMLCtxKrhBRM3+SkyAj4a47/ED+LGcAmyNQVHL35IETNeaEo6T7W6E/yrvhMkpFwphtm4GTVxSg0XabXvBXiu1Cmm7xgYKvhTX+JEzS/ie8WyerX5Hjhl1vETjdtWAkgfgd+xxnaOmdHJVmS/L2UN9QknaBB7fuuglYsHV+UOEOtysKWmmdB5+9epMUl7eDm5jc9pxA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Wed, 01 Jun 2022 09:08:59 +0000
  • Ironport-data: A9a23:SkDDsazU+FJ6VMU1r5x6t+dNxyrEfRIJ4+MujC+fZmUNrF6WrkUFm DMXWDuOMqmNNjCmc413a9u2pEIO6pKEyN5qQFZlpSAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX5JZS5LwbZj2NY22YHhWmthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ NplubuzVzYjJ4b1tadBWTtkFC9aDZZM9+qSSZS/mZT7I0zuVVLJmq0rIGRoeIoS96BwHH1E8 uEeJHYVdBefiumqwbW9DO5xmsAkK8qtN4Qa0p1i5WiBUbB6HtaeE+OTvYEwMDQY36iiGd7EY MUUc3x3ZQnoaBxTIFYHTpk5mY9Eg1GgLmQD9g7I+MLb5UD89glq1pfVG+aLe8WVZZtvvH6Tm lL/qjGR7hYycYb3JSC+2nCmi/LLnCj7cJkPD7D+/flv6HWDy2pWBBAIWF+TpfiillX4S99ZM 1YT+Cclse417kPDZsH0QhmQsHOC+BkGVLJ4DOkS+AyLjK3O7G6k6nMsSzdAbJkqsZEwTDlzj luRxYqxW3poraGfTm+b+vGMtzSuNCMJLGgEIygZUQ8C5Nqlq4Y25v7Scute/GeOpoWdMVnNL /qi9UDSW517YRY36piG
  • Ironport-hdrordr: A9a23:/O5A1a1NF061F+qO2y9BRwqjBSByeYIsimQD101hICG9Lfb0qy n+pp4mPEHP4wr5OEtOpTlPAtjkfZr5z+8M3WB3B8bYYOCGghrQEGgG1+ffKlLbexEWmtQttp uINpIOcuEYbmIK8voSgjPIdOrIqePvmM7IuQ6d9QYKcegDUdAd0+4TMHf+LqQZfnglOXJvf6 Dsm/av6gDQMEg/X4CePD0oTuLDr9rEmNbPZgMHPQcu7E2rgSmz4LD3PhCE1lNGOgk/iosKwC zgqUjU96+ju/a0xlv10HLS1Y1fnJ/ExsFYDMKBp8AJInHHixquZq5mR7qe1QpF6N2H2RIPqp 3hsh0gN8N85zf4eXy0mwLk303a3DMn+xbZuCulqEqmhfa8aCMxCsJHi44cWADe8VAcsNZ117 8O936FtrJMZCmw0xjV1pztbVVHh0C0qX0tnao4lHpES7YTb7dXsMg24F5VKpEdByj3gbpXXN WGNPuspcq+TGnqL0ww5gJUsZ+RtzUIb1q7q3E5y4KoO2M8pgE686MarPZv60vouqhNDqWs3N 60Q5iApIs+MPP+UpgNdNvpYfHHfVAlEii8Rl57HzzcZdI6EkOIjaLLy5MIw8zvUKA07fIJ6e b8uRVjxCQPR34=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Jun 01, 2022 at 09:30:07AM +0200, Jan Beulich wrote:
> On 31.05.2022 18:01, Roger Pau Monné wrote:
> > On Fri, May 27, 2022 at 01:12:48PM +0200, Jan Beulich wrote:
> >> @@ -406,20 +406,41 @@ void __hwdom_init arch_iommu_hwdom_init(
> >>          if ( !perms )
> >>              rc = 0;
> >>          else if ( paging_mode_translate(d) )
> >> +        {
> >>              rc = p2m_add_identity_entry(d, pfn,
> >>                                          perms & IOMMUF_writable ? 
> >> p2m_access_rw
> >>                                                                  : 
> >> p2m_access_r,
> >>                                          0);
> >> +            if ( rc )
> >> +                printk(XENLOG_WARNING
> >> +                       "%pd: identity mapping of %lx failed: %d\n",
> >> +                       d, pfn, rc);
> >> +        }
> >> +        else if ( pfn != start + count || perms != start_perms )
> >> +        {
> >> +        commit:
> >> +            rc = iommu_map(d, _dfn(start), _mfn(start), count, 
> >> start_perms,
> >> +                           &flush_flags);
> >> +            if ( rc )
> >> +                printk(XENLOG_WARNING
> >> +                       "%pd: IOMMU identity mapping of [%lx,%lx) failed: 
> >> %d\n",
> >> +                       d, pfn, pfn + count, rc);
> >> +            SWAP(start, pfn);
> >> +            start_perms = perms;
> >> +            count = 1;
> >> +        }
> >>          else
> >> -            rc = iommu_map(d, _dfn(pfn), _mfn(pfn), 1ul << PAGE_ORDER_4K,
> >> -                           perms, &flush_flags);
> >> +        {
> >> +            ++count;
> >> +            rc = 0;
> >> +        }
> >>  
> >> -        if ( rc )
> >> -            printk(XENLOG_WARNING "%pd: identity %smapping of %lx failed: 
> >> %d\n",
> >> -                   d, !paging_mode_translate(d) ? "IOMMU " : "", pfn, rc);
> >>  
> >> -        if (!(i & 0xfffff))
> >> +        if ( !(++i & 0xfffff) )
> >>              process_pending_softirqs();
> >> +
> >> +        if ( i == top && count )
> > 
> > Nit: do you really need to check for count != 0? AFAICT this is only
> > possible in the first iteration.
> 
> Yes, to avoid taking the PV path for PVH on the last iteration (count
> remains zero for PVH throughout the entire loop).

Oh, I see, that chunk is shared by both PV and PVH.

Thanks, Roger.



 


Rackspace

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