From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "robin.murphy@arm.com" <robin.murphy@arm.com>,
"hch@lst.de" <hch@lst.de>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"patchwork@huawei.com" <patchwork@huawei.com>,
"petrtesarik@huaweicloud.com" <petrtesarik@huaweicloud.com>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
"petr.tesarik1@huawei-partners.com"
<petr.tesarik1@huawei-partners.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "miaoxie@huawei.com" <miaoxie@huawei.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
"guohanjun@huawei.com" <guohanjun@huawei.com>,
"leijitang@huawei.com" <leijitang@huawei.com>,
"weiyongjun1@huawei.com" <weiyongjun1@huawei.com>,
"huawei.libin@huawei.com" <huawei.libin@huawei.com>,
"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
"linuxarm@huawei.com" <linuxarm@huawei.com>,
"johnny.chenyi@huawei.com" <johnny.chenyi@huawei.com>,
"yuehaibing@huawei.com" <yuehaibing@huawei.com>,
"petr@tesarici.cz" <petr@tesarici.cz>,
"roberto.sassu@huaweicloud.com" <roberto.sassu@huaweicloud.com>,
"ming.fu@huawei.com" <ming.fu@huawei.com>,
"zhujianwei7@huawei.com" <zhujianwei7@huawei.com>
Subject: Re: [PATCH v2 1/1] swiotlb: do not free decrypted pages if dynamic
Date: Thu, 2 Nov 2023 15:57:55 +0000 [thread overview]
Message-ID: <e0129428bc80f9deaf7a6852007d48103e133e27.camel@intel.com> (raw)
In-Reply-To: <20231102071821.431-2-petrtesarik@huaweicloud.com>
On Thu, 2023-11-02 at 10:36 +0100, Petr Tesarik wrote:
> + vaddr = phys_to_virt(paddr);
> if (set_memory_decrypted((unsigned long)vaddr,
> PFN_UP(bytes)))
> goto error;
> return page;
>
> error:
> - __free_pages(page, order);
> + /* Intentional leak if pages cannot be encrypted again. */
> + if (!set_memory_encrypted((unsigned long)vaddr,
> PFN_UP(bytes)))
> + __free_pages(page, order);
> return NULL;
> }
My patch was going to just leak the pages if set_memory_decrypted()
fails, and not try to re-encrypt. It didn't seem worth the extra logic
for the rare case. But this works too.
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
next prev parent reply other threads:[~2023-11-02 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 9:36 [PATCH v2 0/1] fix handling of decrypted pages Petr Tesarik
2023-11-02 9:36 ` [PATCH v2 1/1] swiotlb: do not free decrypted pages if dynamic Petr Tesarik
2023-11-02 15:57 ` Edgecombe, Rick P [this message]
2023-11-03 8:35 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e0129428bc80f9deaf7a6852007d48103e133e27.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=guohanjun@huawei.com \
--cc=hch@lst.de \
--cc=huawei.libin@huawei.com \
--cc=iommu@lists.linux.dev \
--cc=johnny.chenyi@huawei.com \
--cc=leijitang@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=m.szyprowski@samsung.com \
--cc=miaoxie@huawei.com \
--cc=ming.fu@huawei.com \
--cc=patchwork@huawei.com \
--cc=petr.tesarik1@huawei-partners.com \
--cc=petr@tesarici.cz \
--cc=petrtesarik@huaweicloud.com \
--cc=roberto.sassu@huaweicloud.com \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--cc=wangkefeng.wang@huawei.com \
--cc=weiyongjun1@huawei.com \
--cc=yuehaibing@huawei.com \
--cc=zhujianwei7@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.