1. 17 7月, 2017 3 次提交
    • D
      spapr: Minor cleanups to events handling · 5341258e
      David Gibson 提交于
      The rtas_error_log structure is marked packed, which strongly suggests its
      precise layout is important to match an external interface.  Along with
      that one could expect it to have a fixed endianness to match the same
      interface.  That used to be the case - matching the layout of PAPR RTAS
      event format and requiring BE fields.
      
      Now, however, it's only used embedded within sPAPREventLogEntry with the
      fields in native order, since they're processed internally.
      
      Clear that up by removing the nested structure in sPAPREventLogEntry.
      struct rtas_error_log is moved back to spapr_events.c where it is used as
      a temporary to help convert the fields in sPAPREventLogEntry to the correct
      in memory format when delivering an event to the guest.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      5341258e
    • D
      spapr: migrate pending_events of spapr state · fd38804b
      Daniel Henrique Barboza 提交于
      In racing situations between hotplug events and migration operation,
      a rtas hotplug event could have not yet be delivered to the source
      guest when migration is started. In this case the pending_events of
      spapr state need be transmitted to the target so that the hotplug
      event can be finished on the target.
      
      To achieve the minimal VMSD possible to migrate the pending_events list,
      this patch makes the changes in spapr_events.c:
      
      - 'log_type' of sPAPREventLogEntry struct deleted. This information can be
      derived by inspecting the rtas_error_log summary field. A new function
      called 'spapr_event_log_entry_type' was added to retrieve the type of
      a given sPAPREventLogEntry.
      
      - sPAPREventLogEntry, epow_log_full and hp_log_full were redesigned. The
      only data we're going to migrate in the VMSD is the event log data itself,
      which can be divided in two parts: a rtas_error_log header and an extended
      event log field. The rtas_error_log header contains information about the
      size of the extended log field, which can be used inside VMSD as the size
      parameter of the VBUFFER_ALOC field that will store it. To allow this use,
      the header.extended_length field must be exposed inline to the VMSD instead
      of embedded into a 'data' field that holds everything. With this in mind,
      the following changes were done:
      
          * a new 'header' field was added to sPAPREventLogEntry. This field holds a
      a struct rtas_error_log inline.
          * the declaration of the 'rtas_error_log' struct was moved to spapr.h
      to be visible to the VMSD macros.
          * 'data' field of sPAPREventLogEntry was renamed to 'extended_log' and
      now holds only the contents of the extended event log.
         *  'struct rtas_error_log hdr' were taken away from both epow_log_full
      and hp_log_full. This information is now available at the header field of
      sPAPREventLogEntry.
         * epow_log_full and hp_log_full were renamed to epow_extended_log and
      hp_extended_log respectively. This rename makes it clearer to understand
      the new purpose of both structures: hold the information of an extended
      event log field.
          * spapr_powerdown_req and spapr_hotplug_req_event now creates a
      sPAPREventLogEntry structure that contains the full rtas log entry.
          * rtas_event_log_queue and rtas_event_log_dequeue now receives a
      sPAPREventLogEntry pointer as a parameter instead of a void pointer.
      
      - the endianess of the sPAPREventLogEntry header is now native instead
      of be32. We can use the fields in native endianess internally and write
      them in be32 in the guest physical memory inside 'check_exception'. This
      allows the VMSD inside spapr.c to read the correct size of the
      entended_log field.
      
      - inside spapr.c, pending_events is put in a subsection in the spapr state
      VMSD to make sure migration across different versions is not broken.
      
      A small change in rtas_event_log_queue and rtas_event_log_dequeue were also
      made: instead of calling qdev_get_machine(), both functions now receive
      a pointer to the sPAPRMachineState. This pointer is already available in
      the callers of these functions and we don't need to waste resources
      calling qdev() again.
      Signed-off-by: NDaniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      fd38804b
    • D
      spapr: Remove unnecessary instance_size specifications from DRC subtypes · 3579d606
      David Gibson 提交于
      All the DRC subtypes explicitly list instance_size in TypeInfo (all as
      sizeof(sPAPRDRConnector).  This isn't necessary, since if it's not listed
      it will be derived from the parent type.
      
      Worse, this is dangerous, because if a subtype is changed in future to
      have a larger structure, then subtypes of that subtype also need to have
      instance_size changed, or it will lead to hard to track memory corruption
      bugs.
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      3579d606
  2. 15 7月, 2017 1 次提交
  3. 14 7月, 2017 36 次提交