Re: [PATCH v4 4/8] s390/airq: use DMA memory for adapter interrupts

Cornelia Huck
2019-06-11T10:17:40Z

On Thu, 6 Jun 2019 13:51:23 +0200
Halil Pasic <pasic@linux.ibm.com> wrote:

> Protected virtualization guests have to use shared pages for airq
> notifier bit vectors, because hypervisor needs to write these bits.
>
> Let us make sure we allocate DMA memory for the notifier bit vectors by
> replacing the kmem_cache with a dma_cache and kalloc() with
> cio_dma_zalloc().
>
> Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
> Reviewed-by: Sebastian Ott <sebott@linux.ibm.com>
> ---
> arch/s390/include/asm/airq.h | 2 ++
> drivers/s390/cio/airq.c | 32 ++++++++++++++++++++------------
> drivers/s390/cio/cio.h | 2 ++
> drivers/s390/cio/css.c | 1 +
> 4 files changed, 25 insertions(+), 12 deletions(-)
>

(...)

> @@ -295,12 +303,12 @@ unsigned long airq_iv_scan(struct airq_iv *iv, unsigned long start,
> }
> EXPORT_SYMBOL(airq_iv_scan);
>
> -static int __init airq_init(void)
> +int __init airq_init(void)
> {
> - airq_iv_cache = kmem_cache_create("airq_iv_cache", cache_line_size(),
> - cache_line_size(), 0, NULL);
> + airq_iv_cache = dma_pool_create("airq_iv_cache", cio_get_dma_css_dev(),
> + cache_line_size(),
> + cache_line_size(), PAGE_SIZE);
> if (!airq_iv_cache)
> return -ENOMEM;

Sorry about not noticing that in the last iteration; but you may return
an error here if airq_iv_cache could not be allocated...

> return 0;
> }
> -subsys_initcall(airq_init);

(...)

> diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
> index 6fc91d534af1..7901c8ed3597 100644
> --- a/drivers/s390/cio/css.c
> +++ b/drivers/s390/cio/css.c
> @@ -1182,6 +1182,7 @@ static int __init css_bus_init(void)
> ret = cio_dma_pool_init();
> if (ret)
> goto out_unregister_pmn;
> + airq_init();

...but don't check the return code here. Probably a pathological case,
but shouldn't you handle that error as well?

> css_init_done = 1;
>
> /* Enable default isc for I/O subchannels. */