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

Re: [PATCH v2] xen/console: Skip switching serial input to non existing domains


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 16 Mar 2023 15:15:01 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=g9LYNhky0ZalROPfhA/Bob2ZCWbNaeuhw3jQBlclqL8=; b=LJhhXzxrf1TK7unkMB/YGMRIDBRl1aaNKkeXszAd0lIz5qWjLRyYe1gYIakDvWx7+HoAMUyRp3aRyVz9HDSujYDkVF7P6/Wbe1MprqGvpAQ5X2oHYx88pwLiv7yWQVoGGbLL1c9Xpz0JzKJCwkZiUdyAsQyUqljWzjejtDRwLO5XMYWwzRkwD4Dbw7VfgnU4fqRTYx18TXfQ4e7pTABNcOlWN72qRZZAQ07WUSEDS6SlH20TcrU1h3tnD5r1crElG+IbzTipPxGazSIEdYoT1ZHWd0zE9iIdGP5B1VTnspykyygZYtGFvTh6jPKWc40gweCnzSg4xdImiludLlXPeQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SQddhhMWANwWneBOdVj3tP32duTUyyvfMS+BLNzb/mxu1tq5CerG/4YOx/pH9dZuyVfI2DjWDKF0C+0gClX6UqioPHsaT7xCA0QapTZOTO3eof2PH4CnQAtpzeebgEyNNGOHJpVcQ3ZjjRLW1nfkueyYh7cSOR2J1g61IVMhS9gnWS5InFrxdsyuyZlsvyqrcQaHQavGigABGfSmpJ0G/vsApYtQqmSYLiJGD3ASodJFhnNHeS7vMK+YlF9uwgQNHbJhj+KAwUyAnomWFykb4Th8aEljFcjQy9lSAWxcaCvyFgjh+zSQq6CwbPLN1EC25rGJw4RqZei4l/9ugoHdxw==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 16 Mar 2023 14:15:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 16/03/2023 12:11, Jan Beulich wrote:
> Caution: This message originated from an External Source. Use proper caution 
> when opening attachments, clicking links, or responding.
> 
> 
> On 16.03.2023 11:26, Michal Orzel wrote:
>> --- a/xen/drivers/char/console.c
>> +++ b/xen/drivers/char/console.c
>> @@ -490,7 +490,24 @@ static void switch_serial_input(void)
>>      }
>>      else
>>      {
>> -        console_rx++;
>> +        unsigned int next_rx = console_rx + 1;
>> +
>> +        /* Skip switching serial input to non existing domains */
>> +        while ( next_rx < max_init_domid + 1 )
>> +        {
>> +            struct domain *d = rcu_lock_domain_by_id(next_rx - 1);
>> +
>> +            if ( d )
>> +            {
>> +                rcu_unlock_domain(d);
>> +                break;
>> +            }
>> +
>> +            next_rx++;
>> +        }
>> +
>> +        console_rx = next_rx;
>> +
>>          printk("*** Serial input to DOM%d", console_rx - 1);
>>      }
> 
> While at the first glance (when you sent it in reply to v1) it looked okay,
> I'm afraid it really isn't: Please consider what happens when the last of
> the DomU-s doesn't exist anymore. (You don't really check whether it still
> exists, because the range check comes ahead of the existence one.) In that
> case you want to move from second-to-last to Xen. I expect the entire
> if/else construct wants to be inside the loop.
I did this deliberately because I do not think the situation you describe is 
possible
(i.e. no domains at all - Xen still usable). With hardware domain in place, we 
can e.g. destroy the domain
which would invoke domain_kill() -> domain_destroy() that would free domain 
struct.
Without hwdom, the domain cannot kill/destroy itself. It can do the shutdown 
but it will not
destroy it (at least this is what I tested). So I do not think there can be a 
scenario where
there is not a single domain while Xen running and be usable.

~Michal



 


Rackspace

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