[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 03/13] vpci: move lock outside of struct vpci
- To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 7 Feb 2022 17:15:43 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=nSVMMSC7IHwKzp7nhCdWYqKZz9yr8xZqfHy5Kf+TDng=; b=L3eocde0XPGiwjxFVVO+a7RJi/uA2IWgoOTRVUS5QpASjNGg4Ji2hoVtrhvmG4n36661I1aeVRWNVKaM/ZGpSFTmGhMCm2vhZsJjbXZoYknr8t5gIBFPOiHVlyat92E1wR7aFyafvx4cuvQaE/nf3kj+cK8je2rAoYcQFuD2pUKf3Ncy4zGl2IL5tfgsYEdVXsauIC/08mjmZS49G36kdNR37bJ54Yy43NoTZkEDeORIUVjhpbX0s167iixYDs7/n7ITloLFI9zG9w8LCSX7kkgwjRId0MK+7QNvGpLTgmASAXGBAB6FanF6iuAJVCRFsY3G/mk8UQEgEDdlQnLvAA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J16YcKCdNiINNCdSL+LT7JAkk3OkFa+Ni1jdLlu6JemRgzwtBWG13GijqKynMJQvQkmHxlFWgOy2k6LcmGd1XJeIRx79TptL3s98Gb2z0jrM9cyX9MyI8akKdwM2SXhD/pmy97W2QlRyjtpRfEhbYb7VkFWcoRranwq4IozPzwvf8say1Kg/8jgALN22psXcbI/YEp3XrWU6XbF3R06a62ACJo7MNxb3oYIa1lqEHjzVamX3MuTBvZ1/IzIvn04cQ9nbjStoM3kxhS6nSEyoOrm37H/EgCoNALZeVbDv5a3oW8tKYLvLCEhVHmNu6YlZ4pmOuaXWBB5KLdLYpSfi1Q==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Mon, 07 Feb 2022 16:15:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 07.02.2022 17:07, Oleksandr Andrushchenko wrote:
> On 07.02.22 17:26, Jan Beulich wrote:
>> 1b. Make vpci_write use write lock for writes to command register and BARs
>> only; keep using the read lock for all other writes.
> I am not quite sure how to do that. Do you mean something like:
> void vpci_write(pci_sbdf_t sbdf, unsigned int reg, unsigned int size,
> uint32_t data)
> [snip]
> list_for_each_entry ( r, &pdev->vpci->handlers, node )
> {
> [snip]
> if ( r->needs_write_lock)
> write_lock(d->vpci_lock)
> else
> read_lock(d->vpci_lock)
> ....
>
> And provide rw as an argument to:
>
> int vpci_add_register(struct vpci *vpci, vpci_read_t *read_handler,
> vpci_write_t *write_handler, unsigned int offset,
> unsigned int size, void *data, --->>> bool write_path
> <<<-----)
>
> Is this what you mean?
This sounds overly complicated. You can derive locally in vpci_write(),
from just its "reg" and "size" parameters, whether the lock needs taking
in write mode.
Jan
|