[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] console: generalize the ability for domU access


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 9 Aug 2023 08:39:37 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; 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=uZ4awkKV8+Y/0cKxPAF4bECQPSCs1gIuSPS13v726vk=; b=EaHtuXRuaJ9Ad0LjFuDg0+WsgooAUNnNcnyXXM2sNOzZMgrHt5a62o4y3ajPL+D+VW4XDWscJGLwWYLXWetxuv6wMQtGoCFfq8SOfKRF8R/lScpvgz2VzmCyCNJZI4/Br0EPAKww3jOyzgK9LyagQx7gHkWu1dXFEt31fr6gBsgo/j2EVMujChTtHRs0R6cob8qvv6caDWxOx29glfgFsy1FO/+Wg+mMqRQ6GyofUdzGq+S4oCOIRL+4fH3u1L4b61YZlq23St4K0GEgUJcvTmVcbd3hPjkvJ1kzgbQpHXbOmiIbB8h42nGhOFTZuiKp9B50tgIYDEfImZJ10nggZQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dlgUx+U4hK1ednOtWqEdo7yGaM6pqnrUnGkzhEiRCkaZRL1S92qmlHxFo8FBgZukn8xMC0aqwN9LM2B80u3ABiHyXG51PN9pwkY1i9qQ+6BnX1cWtVy+zjiIrn58tKFfBGPZcDypwL9MpN5rUsC/fYYYKLdpzOgz2DIf4JEhFxbuAbvZN46dnG7hpnXFW/uWYlMiFXZXsmNQpHhj4l45UHk66Bsei/d1oYFWS1iJzmmBfqPXjsKlZTrFnqaY0XbwYR/bvSwfOVxsR2e+odU1fRcE8fdYVgnpQRX1w5QqVgygIK2npvdAG5aSjJRDdS+3ZKIxVVVYjaDr08FXAuUBTw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Christopher Clark <christopher.w.clark@xxxxxxxxx>, Luca Fancellu <luca.fancellu@xxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 09 Aug 2023 06:39:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.08.2023 18:58, Daniel P. Smith wrote:
> On 8/4/23 03:49, Jan Beulich wrote:
>> On 03.08.2023 18:31, Daniel P. Smith wrote:
>>> On 8/3/23 11:56, Jan Beulich wrote:
>>>> On 03.08.2023 14:56, Daniel P. Smith wrote:
>>>>> On 8/2/23 07:01, Jan Beulich wrote:
>>>>>> On 01.08.2023 18:06, Daniel P. Smith wrote:
>>>>>>> +        {
>>>>>>> +            for_each_domain(next)
>>>>>>
>>>>>> What guarantees that the list won't change behind your back? You don't
>>>>>> hold domlist_read_lock here afaict. It might be that you're safe because
>>>>>> that lock is an RCU one and this function is only invoked at init time
>>>>>> or from some form of interrupt handler. But that's far from obvious and
>>>>>> will hence need both properly confirming and stating in a comment. (It
>>>>>> is actually this concern, iirc, which so far had us avoid iterating the
>>>>>> domain list here.)
>>>>>
>>>>> It is better to error on the side of caution instead of assuming this
>>>>> will always be invoked in a safe manner. I will add a read lock for the
>>>>> domain list.
>>>>
>>>> I'm not firm enough in RCU to be certain whether acquiring that lock is
>>>> permissible here.
>>>
>>> Same and I took your statements to suggest that I should.
>>
>> Actually I wasn't paying close enough attention here: The code already
>> uses rcu_lock_domain_by_id(), which acquires domlist_read_lock.
>>
> 
> Right, it grabs the lock while iterating through domain_hash[], I 
> thought your concern was with regard to the iterating with 
> for_each_domain and the embedded open coded version. Because of your 
> inquiry, I have been thinking about it and I should be grabbing the lock 
> as I iterate to be sure that I don't get deceived into believing the end 
> of list was hit because a domain was being removed as I walked the list. 
> And if it so happens that the context is always safe, then there should 
> be no contention on grabbing the lock. Do you disagree?

Well, RCU locks aren't real locks, so there's no contention in the first
place. As to the context being safe - I continue to be uncertain, but
the pre-existing use of the lock means you adding the necessary locking
to your code won't regress in that regard.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.