From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZQ4k-0002fp-2Q for qemu-devel@nongnu.org; Wed, 22 Jun 2011 12:14:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZQ4g-0002Ka-Vn for qemu-devel@nongnu.org; Wed, 22 Jun 2011 12:14:45 -0400 Received: from david.siemens.de ([192.35.17.14]:26444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZQ4g-0002KE-He for qemu-devel@nongnu.org; Wed, 22 Jun 2011 12:14:42 -0400 Message-ID: <4E0214D8.4060706@siemens.com> Date: Wed, 22 Jun 2011 18:14:16 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <001501cc300e$0b66bea0$22343be0$@Dovgaluk@ispras.ru> <49270.9042774097$1308723700@news.gmane.org> <4E01A3FB.5050706@siemens.com> <003c01cc30ba$9a3b7560$ceb26020$@Dovgaluk@ispras.ru> <4E01B16A.50602@siemens.com> <000001cc30bc$f89067e0$e9b137a0$@Dovgaluk@ispras.ru> <4E01B464.6080802@siemens.com> <000101cc30c5$0dc1ff90$2945feb0$@Dovgaluk@ispras.ru> In-Reply-To: <000101cc30c5$0dc1ff90$2945feb0$@Dovgaluk@ispras.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Fix serial interface vmstate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgaluk Cc: 'qemu-devel' , "quintela@redhat.com" On 2011-06-22 12:13, Pavel Dovgaluk wrote: >> On 2011-06-22 11:15, Pavel Dovgaluk wrote: >>>>>>> What is the purpose of subsections? >>>>>> >>>>>> To skip the new fields whenever possible. That would allow to continue >>>>>> saving a vmstate on a new version of qemu and then restoring it on an >>>>>> older one. >>>>> >>>>> Do you have an idea how to implement "needed" function for my case? >>>>> Because I think, these fields should always be saved and loaded, because >>>>> they are related to the main state of the interface, not the kind of >>>>> optional substate. >>>> >>>> E.g., if the fifo is empty, you do not need to save its content. That >>>> would be one part of the condition. Go through all fields and check if >>>> they have states that could be ignored or if they could be ignored if >>>> other already saved fields have specific values. If you find any new >>>> field that must always be restored, let us discuss it. It may turn out >>>> that a substate is unrealistic, then we need to go with a new version. >>> >>> You mean, if FIFO is empty an will not be saved, we will have to clear >>> it before loading every time? >> >> We (soon, patches posted) do a reset before every loadvm. We already do >> this when starting a new machine. That sets all states that aren't >> restored to defaults. In case of the fifo, they are all emptied. >> >>> So there should be multiple subsections for every possible field? >>> E.g. timers are saved only if they are pending, thr_ipending is saved >>> only when it is nonzero, and so on. Do you mean that? >> >> Nope, only a single subsection. Either we are able to avoid any new >> field under certain circumstances or we have to break the legacy format >> anyway. > > Fields added by my patch are not belong to single subsection. > Consider THR and TSR registers: > THR: > Bit 5 in the LSR, line status register can be used to check if new > information must be written to THR. The value 1 indicates that the > register is empty. > TSR: > Contains data, that should be shifted out. This register is > Interconnected with transmit_timer - when timer event occurs, > the data is shifted out. > There are also other fields, that describe the state of the serial > interface, but cannot be directly derived from THR and TSR state. Neither thr nor tsr are set to a specific value on reset. That indicates that both depend on other states to be valid. Looks like tsr_retry > 0 would be the condition for a tsr worth saving e.g. > > So, there are the following ways, as I see it: > 1. Make several subsections - one for every substate. Again, that comes with no benefits. > 2. Make one subsection with very complex "needed" condition, > which will be true, when any part of the subsection should be > written. I think, that such complex condition will be too hard > for testing. > 3. Change version of the format. I still don't think we have found the case that requires a version change. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux