[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: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Mon, 7 Feb 2022 16:21:23 +0000
- Accept-language: en-US
- 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=Eq+7EehcGxEh9vh0mJqI1Rybd16iu+rAMKtz8Cqgw50=; b=K89mmmX6D311Z87mrxgiDumL65MCTZY1u+HlCkcUpuEviSBGOSjxz2f/6coyNVO61cUFLZLoMV7Kh/lq6XDagG9jlTsYmLkZKCUOD7jVHfVcn7aSQvt3HHDSjlgz8y1fiovZhx/lLQ5nWMygKItK5IzvsRJAeMWfehVrHV3YTHBS0GZHVyy1STCP6tSG8H4GUiGBTTkFTr5fyQ4RBwA8WNF6uOXNFpQ6Yt99tWKlPDUqdJr2pfolY/0CHpDBMSmKclveIYtKqvc40+PqZk61ZcgQEn2Ar0s5DxCldLIS3Vsn+HgoupAf89VFiR4MYMUVO2kOaVUcwJDTyXBS04rpQw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ap4HJzKyz5iHdd7mMcrUwvojqkC9/eHLGUvQtyk0X+6deh9uWmm9N0gLb6chW3w7lxSY+GUwjIObma0j4yEvPHNS07d9jtbDjrbJ+3u00yr0xS1MIf7g4RpwukH2c2jY2VB4f/91e63zK1MRQainjV5AwQuOv5BmFOq/SK2LO1YALJAaaoOGkzHUqv6daVSHj+qOs8J7Yll0Lvtb5+7CewRrp6BgdIpYbqQbKTq5LPagXjU4nlBF742m68bCE5zYRv/rHgzB1nNYEm1hEmGBDb+4Vw2fzeAc8t9HfAPiYHyefgK1CQwmCbVPwkQOxEApHQFxLple0rKvN2gPBAPdmQ==
- 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>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Delivery-date: Mon, 07 Feb 2022 16:22:25 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYGZFc/MnzQOjwVEeBBUHLSW0md6yDBUkAgAASSACAAATYAIAAD/WAgAAKNgCAAAbfgIAABnuAgAAQvgCAAAMCAIAAAY4AgAADxICAABrnAIAABAgAgAR3CoCAABt5gIAAEpuAgAAE5ICAAASKAIAAAiiAgAAKNYCAAARNAIAAC1wAgAACRYCAAAGVgA==
- Thread-topic: [PATCH v6 03/13] vpci: move lock outside of struct vpci
On 07.02.22 18:15, Jan Beulich wrote:
> 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.
Yes, I started writing a reply with that. So, the summary (ROM
position depends on header type):
if ( (reg == PCI_COMMAND) || (reg == ROM) )
{
read PCI_COMMAND and see if memory or IO decoding are enabled.
if ( enabled )
write_lock(d->vpci_lock)
else
read_lock(d->vpci_lock)
}
Do you also think we can drop pdev->vpci (or currently pdev->vpci->lock)
at all then?
> Jan
>
>
Thank you,
Oleksandr
|