ANDROID: arm64: virt: Invalidate tlb once the balloon before reporting/inflating
Instead of invalidating the tlb of the guest every page it relinquishes, invalidate once before the host is informed about the free pages. Bug: 315173520 Change-Id: I8450fd552a27dfc791efa15e884982aeedaa3234 Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@quicinc.com> Signed-off-by: Elliot Berman <elliot.berman@oss.qualcomm.com>
This commit is contained in:
committed by
Todd Kjos
parent
849c862ab9
commit
d3c5649103
@@ -187,6 +187,8 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
|
||||
|
||||
sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns);
|
||||
|
||||
post_page_relinquish_tlb_inv();
|
||||
|
||||
/* We should always be able to add one buffer to an empty queue. */
|
||||
virtqueue_add_outbuf(vq, &sg, 1, vb, GFP_KERNEL);
|
||||
virtqueue_kick(vq);
|
||||
@@ -219,6 +221,8 @@ static int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_i
|
||||
if (WARN_ON_ONCE(err))
|
||||
return err;
|
||||
|
||||
post_page_relinquish_tlb_inv();
|
||||
|
||||
virtqueue_kick(vq);
|
||||
|
||||
/* When host has read buffer, this completes via balloon_ack */
|
||||
|
||||
@@ -16,6 +16,7 @@ struct page;
|
||||
struct virtio_balloon_hyp_ops {
|
||||
bool (*page_relinquish_disallowed)(void);
|
||||
void (*page_relinquish)(struct page *page, unsigned int nr);
|
||||
void (*post_page_relinquish_tlb_inv)(void);
|
||||
};
|
||||
|
||||
extern struct virtio_balloon_hyp_ops *virtio_balloon_hyp_ops;
|
||||
@@ -35,10 +36,17 @@ static inline void page_relinquish(struct page *page, unsigned int nr)
|
||||
return virtio_balloon_hyp_ops->page_relinquish(page, nr);
|
||||
}
|
||||
|
||||
static inline void post_page_relinquish_tlb_inv(void)
|
||||
{
|
||||
if (virtio_balloon_hyp_ops &&
|
||||
virtio_balloon_hyp_ops->post_page_relinquish_tlb_inv)
|
||||
return virtio_balloon_hyp_ops->post_page_relinquish_tlb_inv();
|
||||
}
|
||||
#else /* !CONFIG_VIRTIO_BALLOON_HYP_OPS */
|
||||
|
||||
static inline bool page_relinquish_disallowed(void) { return false; }
|
||||
static inline void page_relinquish(struct page *page, unsigned int nr) { }
|
||||
static inline void post_page_relinquish_tlb_inv(void) { }
|
||||
|
||||
#endif /* CONFIG_VIRTIO_BALLOON_HYP_OPS */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user