From: Dan Carpenter <dan.carpenter@oracle.com>
To: Zhao Yakui <yakui.zhao@intel.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
devel@driverdev.osuosl.org, Yin FengWei <fengwei.yin@intel.com>,
Jason Chen CJ <jason.cj.chen@intel.com>,
Liu Shuo <shuo.a.liu@intel.com>
Subject: Re: [RFC PATCH 11/15] drivers/acrn: add the support of handling emulated ioreq
Date: Fri, 16 Aug 2019 16:39:46 +0300 [thread overview]
Message-ID: <20190816133511.GC3632@kadam> (raw)
In-Reply-To: <1565922356-4488-12-git-send-email-yakui.zhao@intel.com>
On Fri, Aug 16, 2019 at 10:25:52AM +0800, Zhao Yakui wrote:
> +int acrn_ioreq_create_client(unsigned short vmid,
> + ioreq_handler_t handler,
> + void *client_priv,
> + char *name)
> +{
> + struct acrn_vm *vm;
> + struct ioreq_client *client;
> + int client_id;
> +
> + might_sleep();
> +
> + vm = find_get_vm(vmid);
> + if (unlikely(!vm || !vm->req_buf)) {
> + pr_err("acrn-ioreq: failed to find vm from vmid %d\n", vmid);
> + put_vm(vm);
> + return -EINVAL;
> + }
> +
> + client_id = alloc_client();
> + if (unlikely(client_id < 0)) {
> + pr_err("acrn-ioreq: vm[%d] failed to alloc ioreq client\n",
> + vmid);
> + put_vm(vm);
> + return -EINVAL;
> + }
> +
> + client = acrn_ioreq_get_client(client_id);
> + if (unlikely(!client)) {
> + pr_err("failed to get the client.\n");
> + put_vm(vm);
> + return -EINVAL;
Do we need to clean up the alloc_client() allocation?
regards,
dan carpenter
> + }
> +
> + if (handler) {
> + client->handler = handler;
> + client->acrn_create_kthread = true;
> + }
> +
> + client->ref_vm = vm;
> + client->vmid = vmid;
> + client->client_priv = client_priv;
> + if (name)
> + strncpy(client->name, name, sizeof(client->name) - 1);
> + rwlock_init(&client->range_lock);
> + INIT_LIST_HEAD(&client->range_list);
> + init_waitqueue_head(&client->wq);
> +
> + /* When it is added to ioreq_client_list, the refcnt is increased */
> + spin_lock_bh(&vm->ioreq_client_lock);
> + list_add(&client->list, &vm->ioreq_client_list);
> + spin_unlock_bh(&vm->ioreq_client_lock);
> +
> + pr_info("acrn-ioreq: created ioreq client %d\n", client_id);
> +
> + return client_id;
> +}
next prev parent reply other threads:[~2019-08-16 13:42 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 2:25 [RFC PATCH 00/15] acrn: add the ACRN driver module Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 01/15] x86/acrn: Report X2APIC for ACRN guest Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 02/15] x86/acrn: Add two APIs to add/remove driver-specific upcall ISR handler Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 03/15] x86/acrn: Add hypercall for ACRN guest Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 04/15] drivers/acrn: add the basic framework of acrn char device driver Zhao Yakui
2019-08-16 7:05 ` Greg KH
2019-08-19 4:02 ` Zhao, Yakui
2019-08-19 5:26 ` Greg KH
2019-08-16 11:28 ` Dan Carpenter
2019-08-16 2:25 ` [RFC PATCH 05/15] drivers/acrn: add driver-specific hypercall for ACRN_HSM Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 06/15] drivers/acrn: add the support of querying ACRN api version Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 07/15] drivers/acrn: add acrn vm/vcpu management for ACRN_HSM char device Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 08/15] drivers/acrn: add VM memory management for ACRN " Zhao Yakui
2019-08-16 12:58 ` Dan Carpenter
2019-08-19 5:32 ` Zhao, Yakui
2019-08-19 7:39 ` Dan Carpenter
2019-08-19 7:46 ` Borislav Petkov
2019-08-20 2:25 ` Zhao, Yakui
2019-08-16 2:25 ` [RFC PATCH 09/15] drivers/acrn: add passthrough device support Zhao Yakui
2019-08-16 13:05 ` Dan Carpenter
2019-08-16 2:25 ` [RFC PATCH 10/15] drivers/acrn: add interrupt injection support Zhao Yakui
2019-08-16 13:12 ` Dan Carpenter
2019-08-19 4:59 ` Zhao, Yakui
2019-08-16 2:25 ` [RFC PATCH 11/15] drivers/acrn: add the support of handling emulated ioreq Zhao Yakui
2019-08-16 13:39 ` Dan Carpenter [this message]
2019-08-19 4:54 ` Zhao, Yakui
2019-08-16 2:25 ` [RFC PATCH 12/15] drivers/acrn: add driver-specific IRQ handle to dispatch IO_REQ request Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 13/15] drivers/acrn: add service to obtain Power data transition Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 14/15] drivers/acrn: add the support of irqfd and eventfd Zhao Yakui
2019-08-16 2:25 ` [RFC PATCH 15/15] drivers/acrn: add the support of offline SOS cpu Zhao Yakui
2019-08-19 10:34 ` Dan Carpenter
2019-08-20 2:23 ` Zhao, Yakui
2019-08-16 6:39 ` [RFC PATCH 00/15] acrn: add the ACRN driver module Borislav Petkov
2019-08-16 7:03 ` Greg KH
2019-08-19 2:39 ` Zhao, Yakui
2019-08-19 5:25 ` Greg KH
2019-08-19 1:44 ` Zhao, Yakui
2019-08-19 5:25 ` Greg KH
2019-08-19 5:39 ` Zhao, Yakui
2019-08-19 6:18 ` Borislav Petkov
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=20190816133511.GC3632@kadam \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=fengwei.yin@intel.com \
--cc=jason.cj.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shuo.a.liu@intel.com \
--cc=x86@kernel.org \
--cc=yakui.zhao@intel.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.