lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] Drivers: hv: vmbus: Introduce vmbus_request_addr_match()
> > @@ -1300,25 +1294,60 @@ u64 vmbus_request_addr(struct vmbus_channel
> > *channel, u64 trans_id)
> > if (!trans_id)
> > return VMBUS_RQST_ERROR;
> >
> > - spin_lock_irqsave(&rqstor->req_lock, flags);
> > -
> > /* Data corresponding to trans_id is stored at trans_id - 1 */
> > trans_id--;
> >
> > /* Invalid trans_id */
> > - if (trans_id >= rqstor->size || !test_bit(trans_id, rqstor->req_bitmap)) {
> > - spin_unlock_irqrestore(&rqstor->req_lock, flags);
> > + if (trans_id >= rqstor->size || !test_bit(trans_id, rqstor->req_bitmap))
> > return VMBUS_RQST_ERROR;
> > - }
> >
> > req_addr = rqstor->req_arr[trans_id];
> > - rqstor->req_arr[trans_id] = rqstor->next_request_id;
> > - rqstor->next_request_id = trans_id;
> > + if (rqst_addr == VMBUS_RQST_ADDR_ANY || req_addr == rqst_addr) {
> > + rqstor->req_arr[trans_id] = rqstor->next_request_id;
> > + rqstor->next_request_id = trans_id;
> >
> > - /* The already held spin lock provides atomicity */
> > - bitmap_clear(rqstor->req_bitmap, trans_id, 1);
> > + /* The already held spin lock provides atomicity */
> > + bitmap_clear(rqstor->req_bitmap, trans_id, 1);
> > + }
>
> In the case where a specific match is required, and trans_id is
> valid but the addr's do not match, it looks like this function will
> return the addr that didn't match, without removing the entry.

Yes, that is consistent with the description on vmbus_request_addr_match():

Returns the memory address stored at @trans_id, or VMBUS_RQST_ERROR if
@trans_id is not contained in the requestor.


> Shouldn't it return VMBUS_RQST_ERROR in that case?

Can certainly be done, although I'm not sure to follow your concerns. Can
you elaborate?

Thanks,
Andrea

\
 
 \ /
  Last update: 2022-04-08 18:48    [W:0.061 / U:1.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site